home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 1 / ETO Development Tools 1.iso / Essentials / Developer Essentials Jul 90 / DTS Sample Code / Macintosh Sample Code / Monthly Releases (Compressed) / MacDTS.Sample.Code.90.05.sit / SC.014.CPlusTESample / TESample.cp < prev    next >
MacBinary  |  1990-05-01  |  12.4 KB  |  [TEXT/MPS ]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert MS-DOS Code Page Info (other/dosCodePage) ext Unsupported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, inited, Tue May 1 12:00:00 1990, modified Tue May 1 12:00:00 1990, creator 'MPS ', type ASCII, 11693 bytes "TESample.cp" , at 0x2e2d 744 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[MPS ]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 0b 54 45 53 61 6d 70 | 6c 65 2e 63 70 00 00 00 |..TESamp|le.cp...|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4d 50 53 | 20 01 00 00 00 00 00 00 |.TEXTMPS| .......|
|00000050| 00 00 00 00 00 2d ad 00 | 00 02 e8 a2 63 63 00 a2 |.....-..|....cc..|
|00000060| 63 63 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |cc......|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 d9 b8 00 00 |........|........|
|00000080| 2f 2a 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |/*------|--------|
|00000090| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000a0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000b0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000c0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000d0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 0d 0d 09 50 |--------|----...P|
|000000e0| 72 6f 67 72 61 6d 3a 09 | 43 50 6c 75 73 54 45 53 |rogram:.|CPlusTES|
|000000f0| 61 6d 70 6c 65 20 32 2e | 30 0d 09 46 69 6c 65 3a |ample 2.|0..File:|
|00000100| 09 09 54 45 53 61 6d 70 | 6c 65 2e 63 70 0d 20 20 |..TESamp|le.cp. |
|00000110| 20 20 55 73 65 73 3a 20 | 20 20 20 20 20 20 54 45 | Uses: | TE|
|00000120| 44 6f 63 75 6d 65 6e 74 | 2e 68 0d 20 20 20 20 20 |Document|.h. |
|00000130| 20 20 20 20 20 20 20 20 | 20 20 20 54 45 53 61 6d | | TESam|
|00000140| 70 6c 65 2e 68 0d 0d 09 | 62 79 20 41 6e 64 72 65 |ple.h...|by Andre|
|00000150| 77 20 53 68 65 62 61 6e | 6f 77 0d 09 6f 66 20 41 |w Sheban|ow..of A|
|00000160| 70 70 6c 65 20 4d 61 63 | 69 6e 74 6f 73 68 20 44 |pple Mac|intosh D|
|00000170| 65 76 65 6c 6f 70 65 72 | 20 54 65 63 68 6e 69 63 |eveloper| Technic|
|00000180| 61 6c 20 53 75 70 70 6f | 72 74 0d 0d 09 43 6f 70 |al Suppo|rt...Cop|
|00000190| 79 72 69 67 68 74 20 a9 | 20 31 39 38 39 2d 31 39 |yright .| 1989-19|
|000001a0| 39 30 20 41 70 70 6c 65 | 20 43 6f 6d 70 75 74 65 |90 Apple| Compute|
|000001b0| 72 2c 20 49 6e 63 2e 0d | 09 41 6c 6c 20 72 69 67 |r, Inc..|.All rig|
|000001c0| 68 74 73 20 72 65 73 65 | 72 76 65 64 2e 0d 0d 2d |hts rese|rved...-|
|000001d0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000001e0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000001f0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000200| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000210| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000220| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2a 2f 0d 0d 23 69 66 |--------|-*/..#if|
|00000230| 6e 64 65 66 20 5f 5f 54 | 59 50 45 53 5f 5f 0d 23 |ndef __T|YPES__.#|
|00000240| 69 6e 63 6c 75 64 65 20 | 3c 54 79 70 65 73 2e 68 |include |<Types.h|
|00000250| 3e 0d 23 65 6e 64 69 66 | 0d 23 69 66 6e 64 65 66 |>.#endif|.#ifndef|
|00000260| 20 5f 5f 51 55 49 43 4b | 44 52 41 57 5f 5f 0d 23 | __QUICK|DRAW__.#|
|00000270| 69 6e 63 6c 75 64 65 20 | 3c 51 75 69 63 6b 44 72 |include |<QuickDr|
|00000280| 61 77 2e 68 3e 0d 23 65 | 6e 64 69 66 0d 23 69 66 |aw.h>.#e|ndif.#if|
|00000290| 6e 64 65 66 20 5f 5f 46 | 4f 4e 54 53 5f 5f 0d 23 |ndef __F|ONTS__.#|
|000002a0| 69 6e 63 6c 75 64 65 20 | 3c 46 6f 6e 74 73 2e 68 |include |<Fonts.h|
|000002b0| 3e 0d 23 65 6e 64 69 66 | 0d 23 69 66 6e 64 65 66 |>.#endif|.#ifndef|
|000002c0| 20 5f 5f 45 56 45 4e 54 | 53 5f 5f 0d 23 69 6e 63 | __EVENT|S__.#inc|
|000002d0| 6c 75 64 65 20 3c 45 76 | 65 6e 74 73 2e 68 3e 0d |lude <Ev|ents.h>.|
|000002e0| 23 65 6e 64 69 66 0d 23 | 69 66 6e 64 65 66 20 5f |#endif.#|ifndef _|
|000002f0| 5f 43 4f 4e 54 52 4f 4c | 53 5f 5f 0d 23 69 6e 63 |_CONTROL|S__.#inc|
|00000300| 6c 75 64 65 20 3c 43 6f | 6e 74 72 6f 6c 73 2e 68 |lude <Co|ntrols.h|
|00000310| 3e 0d 23 65 6e 64 69 66 | 0d 23 69 66 6e 64 65 66 |>.#endif|.#ifndef|
|00000320| 20 5f 5f 57 49 4e 44 4f | 57 53 5f 5f 0d 23 69 6e | __WINDO|WS__.#in|
|00000330| 63 6c 75 64 65 20 3c 57 | 69 6e 64 6f 77 73 2e 68 |clude <W|indows.h|
|00000340| 3e 0d 23 65 6e 64 69 66 | 0d 23 69 66 6e 64 65 66 |>.#endif|.#ifndef|
|00000350| 20 5f 5f 4d 45 4e 55 53 | 5f 5f 0d 23 69 6e 63 6c | __MENUS|__.#incl|
|00000360| 75 64 65 20 3c 4d 65 6e | 75 73 2e 68 3e 0d 23 65 |ude <Men|us.h>.#e|
|00000370| 6e 64 69 66 0d 23 69 66 | 6e 64 65 66 20 5f 5f 54 |ndif.#if|ndef __T|
|00000380| 45 58 54 45 44 49 54 5f | 5f 0d 23 69 6e 63 6c 75 |EXTEDIT_|_.#inclu|
|00000390| 64 65 20 3c 54 65 78 74 | 45 64 69 74 2e 68 3e 0d |de <Text|Edit.h>.|
|000003a0| 23 65 6e 64 69 66 0d 23 | 69 66 6e 64 65 66 20 5f |#endif.#|ifndef _|
|000003b0| 5f 44 49 41 4c 4f 47 53 | 5f 5f 0d 23 69 6e 63 6c |_DIALOGS|__.#incl|
|000003c0| 75 64 65 20 3c 44 69 61 | 6c 6f 67 73 2e 68 3e 0d |ude <Dia|logs.h>.|
|000003d0| 23 65 6e 64 69 66 0d 23 | 69 66 6e 64 65 66 20 5f |#endif.#|ifndef _|
|000003e0| 5f 44 45 53 4b 5f 5f 0d | 23 69 6e 63 6c 75 64 65 |_DESK__.|#include|
|000003f0| 20 3c 44 65 73 6b 2e 68 | 3e 0d 23 65 6e 64 69 66 | <Desk.h|>.#endif|
|00000400| 0d 23 69 66 6e 64 65 66 | 20 5f 5f 53 43 52 41 50 |.#ifndef| __SCRAP|
|00000410| 5f 5f 0d 23 69 6e 63 6c | 75 64 65 20 3c 53 63 72 |__.#incl|ude <Scr|
|00000420| 61 70 2e 68 3e 0d 23 65 | 6e 64 69 66 0d 23 69 66 |ap.h>.#e|ndif.#if|
|00000430| 6e 64 65 66 20 5f 5f 54 | 4f 4f 4c 55 54 49 4c 53 |ndef __T|OOLUTILS|
|00000440| 5f 5f 0d 23 69 6e 63 6c | 75 64 65 20 3c 54 6f 6f |__.#incl|ude <Too|
|00000450| 6c 55 74 69 6c 73 2e 68 | 3e 0d 23 65 6e 64 69 66 |lUtils.h|>.#endif|
|00000460| 0d 23 69 66 6e 64 65 66 | 20 5f 5f 4d 45 4d 4f 52 |.#ifndef| __MEMOR|
|00000470| 59 5f 5f 0d 23 69 6e 63 | 6c 75 64 65 20 3c 4d 65 |Y__.#inc|lude <Me|
|00000480| 6d 6f 72 79 2e 68 3e 0d | 23 65 6e 64 69 66 0d 23 |mory.h>.|#endif.#|
|00000490| 69 66 6e 64 65 66 20 5f | 5f 53 45 47 4c 4f 41 44 |ifndef _|_SEGLOAD|
|000004a0| 5f 5f 0d 23 69 6e 63 6c | 75 64 65 20 3c 53 65 67 |__.#incl|ude <Seg|
|000004b0| 4c 6f 61 64 2e 68 3e 0d | 23 65 6e 64 69 66 0d 23 |Load.h>.|#endif.#|
|000004c0| 69 66 6e 64 65 66 20 5f | 5f 46 49 4c 45 53 5f 5f |ifndef _|_FILES__|
|000004d0| 0d 23 69 6e 63 6c 75 64 | 65 20 3c 46 69 6c 65 73 |.#includ|e <Files|
|000004e0| 2e 68 3e 0d 23 65 6e 64 | 69 66 0d 23 69 66 6e 64 |.h>.#end|if.#ifnd|
|000004f0| 65 66 20 5f 5f 4f 53 55 | 54 49 4c 53 5f 5f 0d 23 |ef __OSU|TILS__.#|
|00000500| 69 6e 63 6c 75 64 65 20 | 3c 4f 53 55 74 69 6c 73 |include |<OSUtils|
|00000510| 2e 68 3e 0d 23 65 6e 64 | 69 66 0d 23 69 66 6e 64 |.h>.#end|if.#ifnd|
|00000520| 65 66 20 5f 5f 54 52 41 | 50 53 5f 5f 0d 23 69 6e |ef __TRA|PS__.#in|
|00000530| 63 6c 75 64 65 20 3c 54 | 72 61 70 73 2e 68 3e 0d |clude <T|raps.h>.|
|00000540| 23 65 6e 64 69 66 0d 23 | 69 66 6e 64 65 66 20 5f |#endif.#|ifndef _|
|00000550| 5f 50 41 43 4b 41 47 45 | 53 5f 5f 0d 23 69 6e 63 |_PACKAGE|S__.#inc|
|00000560| 6c 75 64 65 20 3c 50 61 | 63 6b 61 67 65 73 2e 68 |lude <Pa|ckages.h|
|00000570| 3e 0d 23 65 6e 64 69 66 | 0d 23 69 66 6e 64 65 66 |>.#endif|.#ifndef|
|00000580| 20 5f 5f 45 52 52 4f 52 | 53 5f 5f 0d 23 69 6e 63 | __ERROR|S__.#inc|
|00000590| 6c 75 64 65 20 3c 45 72 | 72 6f 72 73 2e 68 3e 0d |lude <Er|rors.h>.|
|000005a0| 23 65 6e 64 69 66 0d 0d | 2f 2f 20 6f 75 72 20 63 |#endif..|// our c|
|000005b0| 6c 61 73 73 20 64 65 66 | 69 6e 69 74 69 6f 6e 73 |lass def|initions|
|000005c0| 0d 23 69 6e 63 6c 75 64 | 65 20 22 54 45 44 6f 63 |.#includ|e "TEDoc|
|000005d0| 75 6d 65 6e 74 2e 68 22 | 0d 23 69 6e 63 6c 75 64 |ument.h"|.#includ|
|000005e0| 65 20 22 54 45 53 61 6d | 70 6c 65 2e 68 22 0d 0d |e "TESam|ple.h"..|
|000005f0| 2f 2f 20 45 78 74 72 65 | 6d 65 4e 65 67 20 61 6e |// Extre|meNeg an|
|00000600| 64 20 45 78 74 72 65 6d | 65 50 6f 73 20 61 72 65 |d Extrem|ePos are|
|00000610| 20 75 73 65 64 20 74 6f | 20 73 65 74 20 75 70 20 | used to| set up |
|00000620| 77 69 64 65 20 6f 70 65 | 6e 20 72 65 63 74 61 6e |wide ope|n rectan|
|00000630| 67 6c 65 73 20 61 6e 64 | 20 72 65 67 69 6f 6e 73 |gles and| regions|
|00000640| 2e 0d 63 6f 6e 73 74 20 | 73 68 6f 72 74 20 6b 45 |..const |short kE|
|00000650| 78 74 72 65 6d 65 4e 65 | 67 20 3d 20 2d 33 32 37 |xtremeNe|g = -327|
|00000660| 36 38 3b 0d 63 6f 6e 73 | 74 20 73 68 6f 72 74 20 |68;.cons|t short |
|00000670| 6b 45 78 74 72 65 6d 65 | 50 6f 73 20 3d 20 33 32 |kExtreme|Pos = 32|
|00000680| 37 36 37 20 2d 20 31 3b | 20 2f 2f 20 72 65 71 75 |767 - 1;| // requ|
|00000690| 69 72 65 64 20 74 6f 20 | 61 64 64 72 65 73 73 20 |ired to |address |
|000006a0| 61 6e 20 6f 6c 64 20 72 | 65 67 69 6f 6e 20 62 75 |an old r|egion bu|
|000006b0| 67 0d 0d 2f 2f 20 6b 4d | 61 78 4f 70 65 6e 44 6f |g..// kM|axOpenDo|
|000006c0| 63 75 6d 65 6e 74 73 20 | 69 73 20 75 73 65 64 20 |cuments |is used |
|000006d0| 74 6f 20 64 65 74 65 72 | 6d 69 6e 65 20 77 68 65 |to deter|mine whe|
|000006e0| 74 68 65 72 20 61 20 6e | 65 77 20 64 6f 63 75 6d |ther a n|ew docum|
|000006f0| 65 6e 74 20 63 61 6e 20 | 62 65 20 6f 70 65 6e 65 |ent can |be opene|
|00000700| 64 0d 2f 2f 20 6f 72 20 | 63 72 65 61 74 65 64 2e |d.// or |created.|
|00000710| 20 57 65 20 6b 65 65 70 | 20 74 72 61 63 6b 20 6f | We keep| track o|
|00000720| 66 20 74 68 65 20 6e 75 | 6d 62 65 72 20 6f 66 20 |f the nu|mber of |
|00000730| 6f 70 65 6e 20 64 6f 63 | 75 6d 65 6e 74 73 2c 20 |open doc|uments, |
|00000740| 61 6e 64 20 64 69 73 61 | 62 6c 65 20 74 68 65 0d |and disa|ble the.|
|00000750| 2f 2f 20 6d 65 6e 75 20 | 69 74 65 6d 73 20 74 68 |// menu |items th|
|00000760| 61 74 20 63 72 65 61 74 | 65 20 61 20 6e 65 77 20 |at creat|e a new |
|00000770| 64 6f 63 75 6d 65 6e 74 | 20 77 68 65 6e 20 74 68 |document| when th|
|00000780| 65 20 6d 61 78 69 6d 75 | 6d 20 69 73 20 72 65 61 |e maximu|m is rea|
|00000790| 63 68 65 64 2e 20 49 66 | 20 74 68 65 0d 2f 2f 20 |ched. If| the.// |
|000007a0| 6e 75 6d 62 65 72 20 6f | 66 20 64 6f 63 75 6d 65 |number o|f docume|
|000007b0| 6e 74 73 20 66 61 6c 6c | 73 20 62 65 6c 6f 77 20 |nts fall|s below |
|000007c0| 74 68 65 20 6d 61 78 69 | 6d 75 6d 2c 20 74 68 65 |the maxi|mum, the|
|000007d0| 20 69 74 65 6d 73 20 61 | 72 65 20 65 6e 61 62 6c | items a|re enabl|
|000007e0| 65 64 20 61 67 61 69 6e | 2e 0d 63 6f 6e 73 74 20 |ed again|..const |
|000007f0| 73 68 6f 72 74 09 6b 4d | 61 78 4f 70 65 6e 44 6f |short.kM|axOpenDo|
|00000800| 63 75 6d 65 6e 74 73 20 | 3d 20 34 3b 0d 0d 63 6f |cuments |= 4;..co|
|00000810| 6e 73 74 20 4f 53 54 79 | 70 65 20 6b 43 72 65 61 |nst OSTy|pe kCrea|
|00000820| 74 6f 72 54 79 70 65 20 | 3d 20 27 4d 4f 4f 54 27 |torType |= 'MOOT'|
|00000830| 3b 0d 0d 2f 2f 20 44 65 | 66 69 6e 65 20 6d 61 78 |;..// De|fine max|
|00000840| 20 61 6e 64 20 6d 69 6e | 20 6d 61 63 72 6f 73 20 | and min| macros |
|00000850| 66 6f 72 20 65 66 66 69 | 63 69 65 6e 63 79 2e 0d |for effi|ciency..|
|00000860| 23 64 65 66 69 6e 65 20 | 6d 61 78 28 61 2c 62 29 |#define |max(a,b)|
|00000870| 09 09 28 28 61 29 20 3e | 20 28 62 29 20 3f 20 28 |..((a) >| (b) ? (|
|00000880| 61 29 20 3a 20 28 62 29 | 29 0d 23 64 65 66 69 6e |a) : (b)|).#defin|
|00000890| 65 20 6d 69 6e 28 61 2c | 62 29 09 09 28 28 61 29 |e min(a,|b)..((a)|
|000008a0| 20 3c 20 28 62 29 20 3f | 20 28 61 29 20 3a 20 28 | < (b) ?| (a) : (|
|000008b0| 62 29 29 0d 0d 2f 2f 20 | 4f 75 72 20 61 70 70 6c |b))..// |Our appl|
|000008c0| 69 63 61 74 69 6f 6e 20 | 6f 62 6a 65 63 74 2c 20 |ication |object, |
|000008d0| 69 6e 69 74 69 61 6c 69 | 7a 65 64 20 69 6e 20 6d |initiali|zed in m|
|000008e0| 61 69 6e 28 29 2e 20 57 | 65 20 6d 61 6b 65 20 69 |ain(). W|e make i|
|000008f0| 74 0d 2f 2f 20 67 6c 6f | 62 61 6c 20 73 6f 20 6f |t.// glo|bal so o|
|00000900| 75 72 20 66 75 6e 63 74 | 69 6f 6e 73 20 77 68 69 |ur funct|ions whi|
|00000910| 63 68 20 64 6f 6e 27 74 | 20 62 65 6c 6f 6e 67 20 |ch don't| belong |
|00000920| 74 6f 20 61 6e 79 20 63 | 6c 61 73 73 0d 2f 2f 20 |to any c|lass.// |
|00000930| 63 61 6e 20 66 69 6e 64 | 20 74 68 65 20 61 63 74 |can find| the act|
|00000940| 69 76 65 20 64 6f 63 75 | 6d 65 6e 74 2e 0d 54 45 |ive docu|ment..TE|
|00000950| 53 61 6d 70 6c 65 2a 20 | 67 54 68 65 41 70 70 6c |Sample* |gTheAppl|
|00000960| 69 63 61 74 69 6f 6e 3b | 0d 0d 2f 2f 20 6d 61 69 |ication;|..// mai|
|00000970| 6e 20 69 73 20 74 68 65 | 20 65 6e 74 72 79 70 6f |n is the| entrypo|
|00000980| 69 6e 74 20 74 6f 20 74 | 68 65 20 70 72 6f 67 72 |int to t|he progr|
|00000990| 61 6d 0d 69 6e 74 20 6d | 61 69 6e 28 29 0d 7b 0d |am.int m|ain().{.|
|000009a0| 09 2f 2f 20 43 72 65 61 | 74 65 20 6f 75 72 20 61 |.// Crea|te our a|
|000009b0| 70 70 6c 69 63 61 74 69 | 6f 6e 20 6f 62 6a 65 63 |pplicati|on objec|
|000009c0| 74 2e 20 54 68 69 73 20 | 4d 55 53 54 20 62 65 20 |t. This |MUST be |
|000009d0| 74 68 65 20 46 49 52 53 | 54 20 74 68 69 6e 67 0d |the FIRS|T thing.|
|000009e0| 09 2f 2f 20 64 6f 6e 65 | 20 69 6e 20 6d 61 69 6e |.// done| in main|
|000009f0| 28 29 2c 20 73 69 6e 63 | 65 20 69 74 20 69 6e 69 |(), sinc|e it ini|
|00000a00| 74 69 61 6c 69 7a 65 73 | 20 74 68 65 20 54 6f 6f |tializes| the Too|
|00000a10| 6c 62 6f 78 20 66 6f 72 | 20 75 73 2e 0d 09 67 54 |lbox for| us...gT|
|00000a20| 68 65 41 70 70 6c 69 63 | 61 74 69 6f 6e 20 3d 20 |heApplic|ation = |
|00000a30| 6e 65 77 20 54 45 53 61 | 6d 70 6c 65 3b 0d 09 69 |new TESa|mple;..i|
|00000a40| 66 20 28 67 54 68 65 41 | 70 70 6c 69 63 61 74 69 |f (gTheA|pplicati|
|00000a50| 6f 6e 20 3d 3d 20 6e 69 | 6c 29 09 09 2f 2f 20 69 |on == ni|l)..// i|
|00000a60| 66 20 77 65 20 63 6f 75 | 6c 64 6e 27 74 20 61 6c |f we cou|ldn't al|
|00000a70| 6c 6f 63 61 74 65 20 6f | 62 6a 65 63 74 20 28 69 |locate o|bject (i|
|00000a80| 6d 70 6f 73 73 69 62 6c | 65 21 3f 29 0d 09 20 20 |mpossibl|e!?).. |
|00000a90| 45 78 69 74 54 6f 53 68 | 65 6c 6c 28 29 3b 09 09 |ExitToSh|ell();..|
|00000aa0| 09 09 2f 2f 20 67 6f 20 | 62 61 63 6b 20 74 6f 20 |..// go |back to |
|00000ab0| 46 69 6e 64 65 72 0d 0d | 09 67 54 68 65 41 70 70 |Finder..|.gTheApp|
|00000ac0| 6c 69 63 61 74 69 6f 6e | 2d 3e 50 72 6f 63 65 73 |lication|->Proces|
|00000ad0| 73 41 72 67 73 28 29 3b | 0d 0d 09 2f 2f 20 53 74 |sArgs();|...// St|
|00000ae0| 61 72 74 20 6f 75 72 20 | 6d 61 69 6e 20 65 76 65 |art our |main eve|
|00000af0| 6e 74 20 6c 6f 6f 70 20 | 72 75 6e 6e 69 6e 67 2e |nt loop |running.|
|00000b00| 20 54 68 69 73 20 77 6f | 6e 27 74 20 72 65 74 75 | This wo|n't retu|
|00000b10| 72 6e 20 75 6e 74 69 6c | 20 75 73 65 72 20 71 75 |rn until| user qu|
|00000b20| 69 74 73 0d 09 67 54 68 | 65 41 70 70 6c 69 63 61 |its..gTh|eApplica|
|00000b30| 74 69 6f 6e 2d 3e 45 76 | 65 6e 74 4c 6f 6f 70 28 |tion->Ev|entLoop(|
|00000b40| 29 3b 0d 0d 09 2f 2f 20 | 57 65 20 61 6c 77 61 79 |);...// |We alway|
|00000b50| 73 20 72 65 74 75 72 6e | 20 61 20 76 61 6c 75 65 |s return| a value|
|00000b60| 2c 20 6c 69 6b 65 20 67 | 6f 6f 64 20 6c 69 74 74 |, like g|ood litt|
|00000b70| 6c 65 20 41 4e 53 49 20 | 77 6f 72 73 68 69 70 70 |le ANSI |worshipp|
|00000b80| 65 72 73 2c 0d 09 2f 2f | 20 73 6f 20 74 68 61 74 |ers,..//| so that|
|00000b90| 20 74 68 65 20 63 6f 6d | 70 69 6c 65 72 20 77 6f | the com|piler wo|
|00000ba0| 6e 27 74 20 63 6f 6d 70 | 6c 61 69 6e 0d 09 72 65 |n't comp|lain..re|
|00000bb0| 74 75 72 6e 20 30 3b 0d | 7d 0d 0d 2f 2f 20 74 68 |turn 0;.|}..// th|
|00000bc0| 65 20 63 6f 6e 73 74 72 | 75 63 74 6f 72 20 66 6f |e constr|uctor fo|
|00000bd0| 72 20 6f 75 72 20 63 6c | 61 73 73 2c 20 63 61 6c |r our cl|ass, cal|
|00000be0| 6c 65 64 20 61 75 74 6f | 6d 61 74 69 63 61 6c 6c |led auto|maticall|
|00000bf0| 79 20 77 68 65 6e 20 77 | 65 20 63 72 65 61 74 65 |y when w|e create|
|00000c00| 0d 2f 2f 20 61 6e 20 69 | 6e 73 74 61 6e 63 65 20 |.// an i|nstance |
|00000c10| 6f 66 20 74 68 69 73 20 | 63 6c 61 73 73 2e 20 49 |of this |class. I|
|00000c20| 6e 20 74 68 69 73 20 70 | 61 72 74 69 63 75 6c 61 |n this p|articula|
|00000c30| 72 20 63 61 73 65 2c 20 | 77 65 20 6f 6e 6c 79 20 |r case, |we only |
|00000c40| 77 61 6e 74 0d 2f 2f 20 | 6f 6e 65 20 69 6e 73 74 |want.// |one inst|
|00000c50| 61 6e 63 65 20 73 69 6e | 63 65 20 74 68 65 20 63 |ance sin|ce the c|
|00000c60| 6f 6e 73 74 72 75 63 74 | 6f 72 20 64 6f 65 73 20 |onstruct|or does |
|00000c70| 61 6c 6c 20 74 68 65 20 | 6d 65 6e 75 20 73 65 74 |all the |menu set|
|00000c80| 75 70 73 20 61 6e 64 0d | 2f 2f 20 63 72 65 61 74 |ups and.|// creat|
|00000c90| 65 73 20 6f 75 72 20 28 | 75 6e 74 69 74 6c 65 64 |es our (|untitled|
|00000ca0| 29 20 64 6f 63 75 6d 65 | 6e 74 2e 0d 2f 2f 20 4e |) docume|nt..// N|
|00000cb0| 6f 74 65 20 74 68 61 74 | 20 77 65 20 63 61 6c 6c |ote that| we call|
|00000cc0| 20 6f 75 72 20 62 61 73 | 65 20 54 41 70 70 6c 69 | our bas|e TAppli|
|00000cd0| 63 61 74 69 6f 6e 20 63 | 6f 6e 73 74 72 75 63 74 |cation c|onstruct|
|00000ce0| 6f 72 2c 20 70 61 73 73 | 69 6e 67 20 69 74 0d 2f |or, pass|ing it./|
|00000cf0| 2f 20 6f 75 72 20 63 72 | 65 61 74 6f 72 20 73 69 |/ our cr|eator si|
|00000d00| 67 6e 61 74 75 72 65 20 | 63 6f 6e 73 74 61 6e 74 |gnature |constant|
|00000d10| 2e 0d 54 45 53 61 6d 70 | 6c 65 3a 3a 54 45 53 61 |..TESamp|le::TESa|
|00000d20| 6d 70 6c 65 28 29 20 3a | 20 54 41 70 70 6c 69 63 |mple() :| TApplic|
|00000d30| 61 74 69 6f 6e 28 6b 43 | 72 65 61 74 6f 72 54 79 |ation(kC|reatorTy|
|00000d40| 70 65 29 0d 7b 0d 09 48 | 61 6e 64 6c 65 09 6d 65 |pe).{..H|andle.me|
|00000d50| 6e 75 42 61 72 3b 0d 0d | 09 2f 2f 20 72 65 61 64 |nuBar;..|.// read|
|00000d60| 20 6d 65 6e 75 73 20 69 | 6e 74 6f 20 6d 65 6e 75 | menus i|nto menu|
|00000d70| 20 62 61 72 0d 09 6d 65 | 6e 75 42 61 72 20 3d 20 | bar..me|nuBar = |
|00000d80| 47 65 74 4e 65 77 4d 42 | 61 72 28 72 4d 65 6e 75 |GetNewMB|ar(rMenu|
|00000d90| 42 61 72 29 3b 0d 09 2f | 2f 20 69 6e 73 74 61 6c |Bar);../|/ instal|
|00000da0| 6c 20 6d 65 6e 75 73 0d | 09 53 65 74 4d 65 6e 75 |l menus.|.SetMenu|
|00000db0| 42 61 72 28 6d 65 6e 75 | 42 61 72 29 3b 0d 09 44 |Bar(menu|Bar);..D|
|00000dc0| 69 73 70 6f 73 48 61 6e | 64 6c 65 28 6d 65 6e 75 |isposHan|dle(menu|
|00000dd0| 42 61 72 29 3b 0d 09 2f | 2f 20 61 64 64 20 44 41 |Bar);../|/ add DA|
|00000de0| 20 6e 61 6d 65 73 20 74 | 6f 20 41 70 70 6c 65 20 | names t|o Apple |
|00000df0| 6d 65 6e 75 0d 09 41 64 | 64 52 65 73 4d 65 6e 75 |menu..Ad|dResMenu|
|00000e00| 28 47 65 74 4d 48 61 6e | 64 6c 65 28 6d 41 70 70 |(GetMHan|dle(mApp|
|00000e10| 6c 65 29 2c 20 27 44 52 | 56 52 27 29 3b 0d 09 44 |le), 'DR|VR');..D|
|00000e20| 72 61 77 4d 65 6e 75 42 | 61 72 28 29 3b 0d 0d 09 |rawMenuB|ar();...|
|00000e30| 2f 2f 20 63 72 65 61 74 | 65 20 65 6d 70 74 79 20 |// creat|e empty |
|00000e40| 6d 6f 75 73 65 20 72 65 | 67 69 6f 6e 0d 09 66 4d |mouse re|gion..fM|
|00000e50| 6f 75 73 65 52 67 6e 20 | 3d 20 4e 65 77 52 67 6e |ouseRgn |= NewRgn|
|00000e60| 28 29 3b 0d 09 2f 2f 20 | 6d 61 6b 65 20 73 75 72 |();..// |make sur|
|00000e70| 65 20 77 65 20 68 61 76 | 65 20 61 20 76 61 6c 69 |e we hav|e a vali|
|00000e80| 64 20 63 75 72 73 6f 72 | 20 72 65 67 69 6f 6e 0d |d cursor| region.|
|00000e90| 09 41 64 6a 75 73 74 43 | 75 72 73 6f 72 28 29 3b |.AdjustC|ursor();|
|00000ea0| 0d 7d 0d 0d 2f 2f 20 54 | 65 6c 6c 20 54 41 70 70 |.}..// T|ell TApp|
|00000eb0| 6c 69 63 61 74 69 6f 6e | 20 63 6c 61 73 73 20 68 |lication| class h|
|00000ec0| 6f 77 20 6d 75 63 68 20 | 68 65 61 70 20 77 65 20 |ow much |heap we |
|00000ed0| 6e 65 65 64 0d 6c 6f 6e | 67 20 54 45 53 61 6d 70 |need.lon|g TESamp|
|00000ee0| 6c 65 3a 3a 48 65 61 70 | 4e 65 65 64 65 64 28 29 |le::Heap|Needed()|
|00000ef0| 0d 7b 0d 09 72 65 74 75 | 72 6e 20 28 6b 4d 69 6e |.{..retu|rn (kMin|
|00000f00| 53 69 7a 65 20 2a 20 31 | 30 32 34 29 3b 0d 7d 0d |Size * 1|024);.}.|
|00000f10| 0d 2f 2f 20 43 61 6c 63 | 75 6c 61 74 65 20 61 20 |.// Calc|ulate a |
|00000f20| 73 6c 65 65 70 20 76 61 | 6c 75 65 20 66 6f 72 20 |sleep va|lue for |
|00000f30| 57 61 69 74 4e 65 78 74 | 45 76 65 6e 74 2e 20 54 |WaitNext|Event. T|
|00000f40| 68 69 73 20 74 61 6b 65 | 73 20 69 6e 74 6f 20 61 |his take|s into a|
|00000f50| 63 63 6f 75 6e 74 20 74 | 68 65 20 74 68 69 6e 67 |ccount t|he thing|
|00000f60| 73 0d 2f 2f 20 74 68 61 | 74 20 44 6f 49 64 6c 65 |s.// tha|t DoIdle|
|00000f70| 20 64 6f 65 73 20 77 69 | 74 68 20 69 64 6c 65 20 | does wi|th idle |
|00000f80| 74 69 6d 65 2e 0d 0d 75 | 6e 73 69 67 6e 65 64 20 |time...u|nsigned |
|00000f90| 6c 6f 6e 67 20 54 45 53 | 61 6d 70 6c 65 3a 3a 53 |long TES|ample::S|
|00000fa0| 6c 65 65 70 56 61 6c 28 | 29 0d 7b 0d 09 75 6e 73 |leepVal(|).{..uns|
|00000fb0| 69 67 6e 65 64 20 6c 6f | 6e 67 20 73 6c 65 65 70 |igned lo|ng sleep|
|00000fc0| 3b 0d 0d 09 73 6c 65 65 | 70 20 3d 20 6b 4d 61 78 |;...slee|p = kMax|
|00000fd0| 53 6c 65 65 70 54 69 6d | 65 3b 09 09 09 09 2f 2f |SleepTim|e;....//|
|00000fe0| 20 64 65 66 61 75 6c 74 | 20 76 61 6c 75 65 20 66 | default| value f|
|00000ff0| 6f 72 20 73 6c 65 65 70 | 0d 09 2f 2f 20 69 66 20 |or sleep|..// if |
|00001000| 77 65 20 61 72 65 6e 27 | 74 20 69 6e 20 62 61 63 |we aren'|t in bac|
|00001010| 6b 67 72 6f 75 6e 64 2c | 20 6c 65 74 20 64 6f 63 |kground,| let doc|
|00001020| 75 6d 65 6e 74 20 74 65 | 6c 6c 20 75 73 20 68 6f |ument te|ll us ho|
|00001030| 77 20 6c 6f 6e 67 20 74 | 6f 20 73 6c 65 65 70 0d |w long t|o sleep.|
|00001040| 09 69 66 20 28 28 21 66 | 49 6e 42 61 63 6b 67 72 |.if ((!f|InBackgr|
|00001050| 6f 75 6e 64 29 20 26 26 | 20 28 66 43 75 72 44 6f |ound) &&| (fCurDo|
|00001060| 63 20 21 3d 20 6e 69 6c | 29 29 0d 09 20 20 73 6c |c != nil|)).. sl|
|00001070| 65 65 70 20 3d 20 6d 69 | 6e 28 73 6c 65 65 70 2c |eep = mi|n(sleep,|
|00001080| 66 43 75 72 44 6f 63 2d | 3e 43 61 6c 63 49 64 6c |fCurDoc-|>CalcIdl|
|00001090| 65 28 29 29 3b 0d 09 72 | 65 74 75 72 6e 20 73 6c |e());..r|eturn sl|
|000010a0| 65 65 70 3b 0d 7d 0d 0d | 2f 2f 20 54 68 69 73 20 |eep;.}..|// This |
|000010b0| 69 73 20 63 61 6c 6c 65 | 64 20 77 68 65 6e 65 76 |is calle|d whenev|
|000010c0| 65 72 20 77 65 20 67 65 | 74 20 61 20 6e 75 6c 6c |er we ge|t a null|
|000010d0| 20 65 76 65 6e 74 20 65 | 74 20 61 6c 2e 0d 2f 2f | event e|t al..//|
|000010e0| 20 49 74 20 74 61 6b 65 | 73 20 63 61 72 65 20 6f | It take|s care o|
|000010f0| 66 20 6e 65 63 65 73 73 | 61 72 79 20 70 65 72 69 |f necess|ary peri|
|00001100| 6f 64 69 63 20 61 63 74 | 69 6f 6e 73 2e 20 46 6f |odic act|ions. Fo|
|00001110| 72 20 74 68 69 73 20 70 | 72 6f 67 72 61 6d 2c 0d |r this p|rogram,.|
|00001120| 2f 2f 20 69 74 20 63 61 | 6c 6c 73 20 54 45 49 64 |// it ca|lls TEId|
|00001130| 6c 65 2e 0d 0d 76 6f 69 | 64 20 54 45 53 61 6d 70 |le...voi|d TESamp|
|00001140| 6c 65 3a 3a 44 6f 49 64 | 6c 65 28 29 0d 7b 0d 09 |le::DoId|le().{..|
|00001150| 54 45 44 6f 63 75 6d 65 | 6e 74 2a 20 66 54 45 43 |TEDocume|nt* fTEC|
|00001160| 75 72 44 6f 63 20 3d 20 | 28 54 45 44 6f 63 75 6d |urDoc = |(TEDocum|
|00001170| 65 6e 74 2a 29 20 66 43 | 75 72 44 6f 63 3b 0d 0d |ent*) fC|urDoc;..|
|00001180| 09 69 66 20 28 66 54 45 | 43 75 72 44 6f 63 20 21 |.if (fTE|CurDoc !|
|00001190| 3d 20 6e 69 6c 29 0d 09 | 20 20 66 54 45 43 75 72 |= nil)..| fTECur|
|000011a0| 44 6f 63 2d 3e 44 6f 49 | 64 6c 65 28 29 3b 0d 7d |Doc->DoI|dle();.}|
|000011b0| 20 2f 2f 20 44 6f 49 64 | 6c 65 0d 0d 2f 2f 20 43 | // DoId|le..// C|
|000011c0| 68 61 6e 67 65 20 74 68 | 65 20 63 75 72 73 6f 72 |hange th|e cursor|
|000011d0| 27 73 20 73 68 61 70 65 | 2c 20 64 65 70 65 6e 64 |'s shape|, depend|
|000011e0| 69 6e 67 20 6f 6e 20 69 | 74 73 20 70 6f 73 69 74 |ing on i|ts posit|
|000011f0| 69 6f 6e 2e 20 54 68 69 | 73 20 61 6c 73 6f 20 63 |ion. Thi|s also c|
|00001200| 61 6c 63 75 6c 61 74 65 | 73 20 61 0d 2f 2f 20 72 |alculate|s a.// r|
|00001210| 65 67 69 6f 6e 20 74 68 | 61 74 20 69 6e 63 6c 75 |egion th|at inclu|
|00001220| 64 65 73 20 74 68 65 20 | 63 75 72 73 6f 72 20 66 |des the |cursor f|
|00001230| 6f 72 20 57 61 69 74 4e | 65 78 74 45 76 65 6e 74 |or WaitN|extEvent|
|00001240| 2e 0d 0d 76 6f 69 64 20 | 54 45 53 61 6d 70 6c 65 |...void |TESample|
|00001250| 3a 3a 41 64 6a 75 73 74 | 43 75 72 73 6f 72 28 29 |::Adjust|Cursor()|
|00001260| 0d 7b 0d 09 54 45 44 6f | 63 75 6d 65 6e 74 2a 20 |.{..TEDo|cument* |
|00001270| 66 54 45 43 75 72 44 6f | 63 20 3d 20 28 54 45 44 |fTECurDo|c = (TED|
|00001280| 6f 63 75 6d 65 6e 74 2a | 29 20 66 43 75 72 44 6f |ocument*|) fCurDo|
|00001290| 63 3b 0d 0d 09 2f 2f 20 | 6e 6f 74 69 63 65 20 74 |c;...// |notice t|
|000012a0| 68 61 74 20 77 65 20 64 | 6f 6e 27 74 20 63 68 61 |hat we d|on't cha|
|000012b0| 6e 67 65 20 63 75 72 73 | 6f 72 20 69 66 20 66 72 |nge curs|or if fr|
|000012c0| 6f 6e 74 20 77 69 6e 64 | 6f 77 20 69 73 6e 27 74 |ont wind|ow isn't|
|000012d0| 20 6f 75 72 73 0d 09 69 | 66 20 28 20 28 21 66 49 | ours..i|f ( (!fI|
|000012e0| 6e 42 61 63 6b 67 72 6f | 75 6e 64 29 20 26 26 20 |nBackgro|und) && |
|000012f0| 28 66 54 45 43 75 72 44 | 6f 63 20 21 3d 20 6e 69 |(fTECurD|oc != ni|
|00001300| 6c 29 20 29 0d 09 20 20 | 7b 0d 09 09 52 67 6e 48 |l) ).. |{...RgnH|
|00001310| 61 6e 64 6c 65 09 61 72 | 72 6f 77 52 67 6e 3b 0d |andle.ar|rowRgn;.|
|00001320| 09 09 52 67 6e 48 61 6e | 64 6c 65 09 69 42 65 61 |..RgnHan|dle.iBea|
|00001330| 6d 52 67 6e 3b 0d 09 09 | 50 6f 69 6e 74 09 09 6d |mRgn;...|Point..m|
|00001340| 6f 75 73 65 3b 0d 0d 09 | 09 2f 2f 20 67 65 74 20 |ouse;...|.// get |
|00001350| 6d 6f 75 73 65 20 6c 6f | 63 61 74 69 6f 6e 20 61 |mouse lo|cation a|
|00001360| 6e 64 20 63 6f 6e 76 65 | 72 74 20 74 6f 20 67 6c |nd conve|rt to gl|
|00001370| 6f 62 61 6c 20 63 6f 6f | 72 64 69 6e 61 74 65 73 |obal coo|rdinates|
|00001380| 0d 09 09 47 65 74 4d 6f | 75 73 65 28 26 6d 6f 75 |...GetMo|use(&mou|
|00001390| 73 65 29 3b 0d 09 09 4c | 6f 63 61 6c 54 6f 47 6c |se);...L|ocalToGl|
|000013a0| 6f 62 61 6c 28 26 6d 6f | 75 73 65 29 3b 0d 0d 09 |obal(&mo|use);...|
|000013b0| 09 2f 2f 20 63 61 6c 63 | 75 6c 61 74 65 20 72 65 |.// calc|ulate re|
|000013c0| 67 69 6f 6e 73 20 66 6f | 72 20 64 69 66 66 65 72 |gions fo|r differ|
|000013d0| 65 6e 74 20 63 75 72 73 | 6f 72 20 73 68 61 70 65 |ent curs|or shape|
|000013e0| 73 0d 09 09 61 72 72 6f | 77 52 67 6e 20 3d 20 4e |s...arro|wRgn = N|
|000013f0| 65 77 52 67 6e 28 29 3b | 0d 09 09 69 42 65 61 6d |ewRgn();|...iBeam|
|00001400| 52 67 6e 20 3d 20 4e 65 | 77 52 67 6e 28 29 3b 0d |Rgn = Ne|wRgn();.|
|00001410| 09 09 2f 2f 20 73 74 61 | 72 74 20 61 72 72 6f 77 |..// sta|rt arrow|
|00001420| 52 67 6e 20 77 69 64 65 | 20 6f 70 65 6e 0d 09 09 |Rgn wide| open...|
|00001430| 53 65 74 52 65 63 74 52 | 67 6e 28 61 72 72 6f 77 |SetRectR|gn(arrow|
|00001440| 52 67 6e 2c 20 6b 45 78 | 74 72 65 6d 65 4e 65 67 |Rgn, kEx|tremeNeg|
|00001450| 2c 20 6b 45 78 74 72 65 | 6d 65 4e 65 67 2c 20 6b |, kExtre|meNeg, k|
|00001460| 45 78 74 72 65 6d 65 50 | 6f 73 2c 20 6b 45 78 74 |ExtremeP|os, kExt|
|00001470| 72 65 6d 65 50 6f 73 29 | 3b 0d 09 09 2f 2f 20 63 |remePos)|;...// c|
|00001480| 61 6c 63 75 6c 61 74 65 | 20 69 42 65 61 6d 52 67 |alculate| iBeamRg|
|00001490| 6e 0d 09 09 66 54 45 43 | 75 72 44 6f 63 2d 3e 47 |n...fTEC|urDoc->G|
|000014a0| 65 74 56 69 73 54 45 52 | 67 6e 28 69 42 65 61 6d |etVisTER|gn(iBeam|
|000014b0| 52 67 6e 29 3b 0d 09 09 | 2f 2f 20 73 75 62 74 72 |Rgn);...|// subtr|
|000014c0| 61 63 74 20 69 42 65 61 | 6d 52 67 6e 20 66 72 6f |act iBea|mRgn fro|
|000014d0| 6d 20 61 72 72 6f 77 52 | 67 6e 0d 09 09 44 69 66 |m arrowR|gn...Dif|
|000014e0| 66 52 67 6e 28 61 72 72 | 6f 77 52 67 6e 2c 20 69 |fRgn(arr|owRgn, i|
|000014f0| 42 65 61 6d 52 67 6e 2c | 20 61 72 72 6f 77 52 67 |BeamRgn,| arrowRg|
|00001500| 6e 29 3b 0d 0d 09 09 2f | 2f 20 63 68 61 6e 67 65 |n);..../|/ change|
|00001510| 20 74 68 65 20 63 75 72 | 73 6f 72 20 61 6e 64 20 | the cur|sor and |
|00001520| 74 68 65 20 72 65 67 69 | 6f 6e 20 70 61 72 61 6d |the regi|on param|
|00001530| 65 74 65 72 0d 09 09 69 | 66 20 28 50 74 49 6e 52 |eter...i|f (PtInR|
|00001540| 67 6e 28 6d 6f 75 73 65 | 2c 20 69 42 65 61 6d 52 |gn(mouse|, iBeamR|
|00001550| 67 6e 29 29 0d 09 09 20 | 20 7b 0d 09 09 09 53 65 |gn))... | {....Se|
|00001560| 74 43 75 72 73 6f 72 28 | 2a 47 65 74 43 75 72 73 |tCursor(|*GetCurs|
|00001570| 6f 72 28 69 42 65 61 6d | 43 75 72 73 6f 72 29 29 |or(iBeam|Cursor))|
|00001580| 3b 0d 09 09 09 43 6f 70 | 79 52 67 6e 28 69 42 65 |;....Cop|yRgn(iBe|
|00001590| 61 6d 52 67 6e 2c 20 66 | 4d 6f 75 73 65 52 67 6e |amRgn, f|MouseRgn|
|000015a0| 29 3b 0d 09 09 20 20 7d | 0d 09 09 65 6c 73 65 0d |);... }|...else.|
|000015b0| 09 09 20 20 7b 0d 09 09 | 09 53 65 74 43 75 72 73 |.. {...|.SetCurs|
|000015c0| 6f 72 28 26 71 64 2e 61 | 72 72 6f 77 29 3b 0d 09 |or(&qd.a|rrow);..|
|000015d0| 09 09 43 6f 70 79 52 67 | 6e 28 61 72 72 6f 77 52 |..CopyRg|n(arrowR|
|000015e0| 67 6e 2c 20 66 4d 6f 75 | 73 65 52 67 6e 29 3b 0d |gn, fMou|seRgn);.|
|000015f0| 09 09 20 20 7d 0d 09 09 | 2f 2f 20 67 65 74 20 72 |.. }...|// get r|
|00001600| 69 64 20 6f 66 20 72 65 | 67 69 6f 6e 73 20 77 65 |id of re|gions we|
|00001610| 20 64 6f 6e 27 74 20 6e | 65 65 64 20 61 6e 79 6d | don't n|eed anym|
|00001620| 6f 72 65 0d 09 09 44 69 | 73 70 6f 73 65 52 67 6e |ore...Di|sposeRgn|
|00001630| 28 61 72 72 6f 77 52 67 | 6e 29 3b 0d 09 09 44 69 |(arrowRg|n);...Di|
|00001640| 73 70 6f 73 65 52 67 6e | 28 69 42 65 61 6d 52 67 |sposeRgn|(iBeamRg|
|00001650| 6e 29 3b 0d 09 20 20 7d | 0d 7d 20 2f 2f 20 41 64 |n);.. }|.} // Ad|
|00001660| 6a 75 73 74 43 75 72 73 | 6f 72 0d 0d 2f 2f 20 45 |justCurs|or..// E|
|00001670| 6e 61 62 6c 65 20 61 6e | 64 20 64 69 73 61 62 6c |nable an|d disabl|
|00001680| 65 20 6d 65 6e 75 73 20 | 62 61 73 65 64 20 6f 6e |e menus |based on|
|00001690| 20 74 68 65 20 63 75 72 | 72 65 6e 74 20 73 74 61 | the cur|rent sta|
|000016a0| 74 65 2e 20 54 68 65 0d | 2f 2f 20 75 73 65 72 20 |te. The.|// user |
|000016b0| 63 61 6e 20 6f 6e 6c 79 | 20 73 65 6c 65 63 74 20 |can only| select |
|000016c0| 65 6e 61 62 6c 65 64 20 | 6d 65 6e 75 20 69 74 65 |enabled |menu ite|
|000016d0| 6d 73 2e 20 57 65 20 73 | 65 74 20 75 70 20 61 6c |ms. We s|et up al|
|000016e0| 6c 20 74 68 65 0d 2f 2f | 20 6d 65 6e 75 20 69 74 |l the.//| menu it|
|000016f0| 65 6d 73 20 62 65 66 6f | 72 65 20 63 61 6c 6c 69 |ems befo|re calli|
|00001700| 6e 67 20 4d 65 6e 75 53 | 65 6c 65 63 74 20 6f 72 |ng MenuS|elect or|
|00001710| 20 4d 65 6e 75 4b 65 79 | 2c 20 73 69 6e 63 65 0d | MenuKey|, since.|
|00001720| 2f 2f 20 74 68 65 73 65 | 20 61 72 65 20 74 68 65 |// these| are the|
|00001730| 20 6f 6e 6c 79 20 74 69 | 6d 65 73 20 74 68 61 74 | only ti|mes that|
|00001740| 20 61 20 6d 65 6e 75 20 | 69 74 65 6d 20 63 61 6e | a menu |item can|
|00001750| 20 62 65 20 73 65 6c 65 | 63 74 65 64 2e 0d 2f 2f | be sele|cted..//|
|00001760| 20 4e 6f 74 65 20 74 68 | 61 74 20 4d 65 6e 75 53 | Note th|at MenuS|
|00001770| 65 6c 65 63 74 20 69 73 | 20 61 6c 73 6f 20 74 68 |elect is| also th|
|00001780| 65 20 6f 6e 6c 79 20 74 | 69 6d 65 20 74 68 65 20 |e only t|ime the |
|00001790| 75 73 65 72 20 77 69 6c | 6c 0d 2f 2f 20 73 65 65 |user wil|l.// see|
|000017a0| 20 6d 65 6e 75 20 69 74 | 65 6d 73 2e 20 54 68 69 | menu it|ems. Thi|
|000017b0| 73 20 61 70 70 72 6f 61 | 63 68 20 74 6f 20 64 65 |s approa|ch to de|
|000017c0| 63 69 64 69 6e 67 20 77 | 68 61 74 20 65 6e 61 62 |ciding w|hat enab|
|000017d0| 6c 65 2f 0d 2f 2f 20 64 | 69 73 61 62 6c 65 20 73 |le/.// d|isable s|
|000017e0| 74 61 74 65 20 61 20 6d | 65 6e 75 20 69 74 65 6d |tate a m|enu item|
|000017f0| 20 68 61 73 20 74 68 65 | 20 61 64 76 61 6e 74 61 | has the| advanta|
|00001800| 67 65 20 6f 66 0d 2f 2f | 20 63 6f 6e 63 65 6e 74 |ge of.//| concent|
|00001810| 72 61 74 69 6e 67 20 61 | 6c 6c 20 74 68 65 20 64 |rating a|ll the d|
|00001820| 65 63 69 73 69 6f 6e 2d | 6d 61 6b 69 6e 67 20 69 |ecision-|making i|
|00001830| 6e 20 6f 6e 65 20 72 6f | 75 74 69 6e 65 2c 20 61 |n one ro|utine, a|
|00001840| 73 0d 2f 2f 20 6f 70 70 | 6f 73 65 64 20 74 6f 20 |s.// opp|osed to |
|00001850| 62 65 69 6e 67 20 73 70 | 72 65 61 64 20 74 68 72 |being sp|read thr|
|00001860| 6f 75 67 68 6f 75 74 20 | 74 68 65 20 61 70 70 6c |oughout |the appl|
|00001870| 69 63 61 74 69 6f 6e 2e | 20 4f 74 68 65 72 0d 2f |ication.| Other./|
|00001880| 2f 20 61 70 70 6c 69 63 | 61 74 69 6f 6e 20 64 65 |/ applic|ation de|
|00001890| 73 69 67 6e 73 20 6d 61 | 79 20 74 61 6b 65 20 61 |signs ma|y take a|
|000018a0| 20 64 69 66 66 65 72 65 | 6e 74 20 61 70 70 72 6f | differe|nt appro|
|000018b0| 61 63 68 20 74 68 61 74 | 20 6d 61 79 0d 2f 2f 20 |ach that| may.// |
|000018c0| 6f 72 20 6d 61 79 20 6e | 6f 74 20 62 65 20 61 73 |or may n|ot be as|
|000018d0| 20 76 61 6c 69 64 2e 0d | 0d 76 6f 69 64 20 54 45 | valid..|.void TE|
|000018e0| 53 61 6d 70 6c 65 3a 3a | 41 64 6a 75 73 74 4d 65 |Sample::|AdjustMe|
|000018f0| 6e 75 73 28 29 0d 7b 0d | 09 57 69 6e 64 6f 77 50 |nus().{.|.WindowP|
|00001900| 74 72 09 66 72 6f 6e 74 | 6d 6f 73 74 3b 0d 09 4d |tr.front|most;..M|
|00001910| 65 6e 75 48 61 6e 64 6c | 65 09 66 69 6c 65 4d 65 |enuHandl|e.fileMe|
|00001920| 6e 75 2c 20 65 64 69 74 | 4d 65 6e 75 3b 0d 09 6c |nu, edit|Menu;..l|
|00001930| 6f 6e 67 09 09 6f 66 66 | 73 65 74 3b 0d 09 42 6f |ong..off|set;..Bo|
|00001940| 6f 6c 65 61 6e 09 09 75 | 6e 64 6f 3b 0d 09 42 6f |olean..u|ndo;..Bo|
|00001950| 6f 6c 65 61 6e 09 09 63 | 75 74 43 6f 70 79 43 6c |olean..c|utCopyCl|
|00001960| 65 61 72 3b 0d 09 42 6f | 6f 6c 65 61 6e 09 09 70 |ear;..Bo|olean..p|
|00001970| 61 73 74 65 3b 0d 09 42 | 6f 6f 6c 65 61 6e 09 09 |aste;..B|oolean..|
|00001980| 73 61 76 65 2c 20 73 61 | 76 65 41 73 3b 0d 09 42 |save, sa|veAs;..B|
|00001990| 6f 6f 6c 65 61 6e 09 09 | 73 65 6c 65 63 74 41 6c |oolean..|selectAl|
|000019a0| 6c 3b 0d 09 54 45 44 6f | 63 75 6d 65 6e 74 2a 20 |l;..TEDo|cument* |
|000019b0| 66 54 45 43 75 72 44 6f | 63 20 3d 20 28 54 45 44 |fTECurDo|c = (TED|
|000019c0| 6f 63 75 6d 65 6e 74 2a | 29 20 66 43 75 72 44 6f |ocument*|) fCurDo|
|000019d0| 63 3b 0d 0d 09 66 72 6f | 6e 74 6d 6f 73 74 20 3d |c;...fro|ntmost =|
|000019e0| 20 46 72 6f 6e 74 57 69 | 6e 64 6f 77 28 29 3b 0d | FrontWi|ndow();.|
|000019f0| 0d 09 66 69 6c 65 4d 65 | 6e 75 20 3d 20 47 65 74 |..fileMe|nu = Get|
|00001a00| 4d 48 61 6e 64 6c 65 28 | 6d 46 69 6c 65 29 3b 0d |MHandle(|mFile);.|
|00001a10| 09 69 66 20 28 66 44 6f | 63 4c 69 73 74 2d 3e 4e |.if (fDo|cList->N|
|00001a20| 75 6d 44 6f 63 73 28 29 | 20 3c 20 6b 4d 61 78 4f |umDocs()| < kMaxO|
|00001a30| 70 65 6e 44 6f 63 75 6d | 65 6e 74 73 29 0d 09 20 |penDocum|ents).. |
|00001a40| 20 7b 0d 09 09 2f 2f 20 | 4e 65 77 20 26 20 4f 70 | {...// |New & Op|
|00001a50| 65 6e 20 61 72 65 20 65 | 6e 61 62 6c 65 64 20 77 |en are e|nabled w|
|00001a60| 68 65 6e 20 77 65 20 63 | 61 6e 20 6f 70 65 6e 20 |hen we c|an open |
|00001a70| 6d 6f 72 65 20 64 6f 63 | 75 6d 65 6e 74 73 0d 09 |more doc|uments..|
|00001a80| 09 45 6e 61 62 6c 65 49 | 74 65 6d 28 66 69 6c 65 |.EnableI|tem(file|
|00001a90| 4d 65 6e 75 2c 20 69 4e | 65 77 29 3b 0d 09 09 45 |Menu, iN|ew);...E|
|00001aa0| 6e 61 62 6c 65 49 74 65 | 6d 28 66 69 6c 65 4d 65 |nableIte|m(fileMe|
|00001ab0| 6e 75 2c 20 69 4f 70 65 | 6e 29 3b 0d 09 20 20 7d |nu, iOpe|n);.. }|
|00001ac0| 0d 09 65 6c 73 65 0d 09 | 20 20 7b 0d 09 09 44 69 |..else..| {...Di|
|00001ad0| 73 61 62 6c 65 49 74 65 | 6d 28 66 69 6c 65 4d 65 |sableIte|m(fileMe|
|00001ae0| 6e 75 2c 20 69 4e 65 77 | 29 3b 0d 09 09 44 69 73 |nu, iNew|);...Dis|
|00001af0| 61 62 6c 65 49 74 65 6d | 28 66 69 6c 65 4d 65 6e |ableItem|(fileMen|
|00001b00| 75 2c 20 69 4f 70 65 6e | 29 3b 0d 09 20 20 7d 0d |u, iOpen|);.. }.|
|00001b10| 09 69 66 20 28 66 72 6f | 6e 74 6d 6f 73 74 20 21 |.if (fro|ntmost !|
|00001b20| 3d 20 28 57 69 6e 64 6f | 77 50 74 72 29 20 6e 69 |= (Windo|wPtr) ni|
|00001b30| 6c 29 09 2f 2f 20 43 6c | 6f 73 65 20 69 73 20 65 |l).// Cl|ose is e|
|00001b40| 6e 61 62 6c 65 64 20 77 | 68 65 6e 20 74 68 65 72 |nabled w|hen ther|
|00001b50| 65 20 69 73 20 61 20 77 | 69 6e 64 6f 77 20 74 6f |e is a w|indow to|
|00001b60| 20 63 6c 6f 73 65 0d 09 | 20 20 45 6e 61 62 6c 65 | close..| Enable|
|00001b70| 49 74 65 6d 28 66 69 6c | 65 4d 65 6e 75 2c 20 69 |Item(fil|eMenu, i|
|00001b80| 43 6c 6f 73 65 29 3b 0d | 09 65 6c 73 65 20 44 69 |Close);.|.else Di|
|00001b90| 73 61 62 6c 65 49 74 65 | 6d 28 66 69 6c 65 4d 65 |sableIte|m(fileMe|
|00001ba0| 6e 75 2c 20 69 43 6c 6f | 73 65 29 3b 0d 0d 09 65 |nu, iClo|se);...e|
|00001bb0| 64 69 74 4d 65 6e 75 20 | 3d 20 47 65 74 4d 48 61 |ditMenu |= GetMHa|
|00001bc0| 6e 64 6c 65 28 6d 45 64 | 69 74 29 3b 0d 09 75 6e |ndle(mEd|it);..un|
|00001bd0| 64 6f 20 3d 20 66 61 6c | 73 65 3b 0d 09 63 75 74 |do = fal|se;..cut|
|00001be0| 43 6f 70 79 43 6c 65 61 | 72 20 3d 20 66 61 6c 73 |CopyClea|r = fals|
|00001bf0| 65 3b 0d 09 70 61 73 74 | 65 20 3d 20 66 61 6c 73 |e;..past|e = fals|
|00001c00| 65 3b 0d 09 73 61 76 65 | 20 3d 20 73 61 76 65 41 |e;..save| = saveA|
|00001c10| 73 20 3d 20 66 61 6c 73 | 65 3b 0d 09 73 65 6c 65 |s = fals|e;..sele|
|00001c20| 63 74 41 6c 6c 20 3d 20 | 66 61 6c 73 65 3b 0d 09 |ctAll = |false;..|
|00001c30| 69 66 20 28 66 72 6f 6e | 74 6d 6f 73 74 20 21 3d |if (fron|tmost !=|
|00001c40| 20 6e 69 6c 29 0d 09 20 | 20 7b 0d 09 09 73 65 6c | nil).. | {...sel|
|00001c50| 65 63 74 41 6c 6c 20 3d | 20 74 72 75 65 3b 0d 09 |ectAll =| true;..|
|00001c60| 09 69 66 20 28 66 43 75 | 72 44 6f 63 20 3d 3d 20 |.if (fCu|rDoc == |
|00001c70| 6e 69 6c 29 0d 09 09 20 | 20 7b 0d 09 09 09 75 6e |nil)... | {....un|
|00001c80| 64 6f 20 3d 20 74 72 75 | 65 3b 09 09 09 09 2f 2f |do = tru|e;....//|
|00001c90| 20 61 6c 6c 20 65 64 69 | 74 69 6e 67 20 69 73 20 | all edi|ting is |
|00001ca0| 65 6e 61 62 6c 65 64 20 | 66 6f 72 20 44 41 20 77 |enabled |for DA w|
|00001cb0| 69 6e 64 6f 77 73 0d 09 | 09 09 63 75 74 43 6f 70 |indows..|..cutCop|
|00001cc0| 79 43 6c 65 61 72 20 3d | 20 74 72 75 65 3b 0d 09 |yClear =| true;..|
|00001cd0| 09 09 70 61 73 74 65 20 | 3d 20 74 72 75 65 3b 0d |..paste |= true;.|
|00001ce0| 09 09 20 20 7d 0d 09 09 | 65 6c 73 65 0d 09 09 20 |.. }...|else... |
|00001cf0| 20 7b 0d 09 09 09 2f 2f | 20 43 75 74 2c 20 43 6f | {....//| Cut, Co|
|00001d00| 70 79 2c 20 61 6e 64 20 | 43 6c 65 61 72 20 69 73 |py, and |Clear is|
|00001d10| 20 65 6e 61 62 6c 65 64 | 20 66 6f 72 20 61 70 70 | enabled| for app|
|00001d20| 2e 20 77 69 6e 64 6f 77 | 73 20 77 69 74 68 20 73 |. window|s with s|
|00001d30| 65 6c 65 63 74 69 6f 6e | 73 0d 09 09 09 69 66 20 |election|s....if |
|00001d40| 28 20 66 54 45 43 75 72 | 44 6f 63 2d 3e 48 61 76 |( fTECur|Doc->Hav|
|00001d50| 65 53 65 6c 65 63 74 69 | 6f 6e 28 29 20 29 0d 09 |eSelecti|on() )..|
|00001d60| 09 09 20 20 63 75 74 43 | 6f 70 79 43 6c 65 61 72 |.. cutC|opyClear|
|00001d70| 20 3d 20 74 72 75 65 3b | 0d 09 09 09 2f 2f 20 49 | = true;|....// I|
|00001d80| 66 20 77 65 20 68 61 76 | 65 20 61 6e 79 20 54 45 |f we hav|e any TE|
|00001d90| 58 54 20 69 6e 20 74 68 | 65 20 73 63 72 61 70 2c |XT in th|e scrap,|
|00001da0| 20 65 6e 61 62 6c 65 20 | 70 61 73 74 65 0d 09 09 | enable |paste...|
|00001db0| 09 69 66 20 28 20 47 65 | 74 53 63 72 61 70 28 6e |.if ( Ge|tScrap(n|
|00001dc0| 69 6c 2c 20 27 54 45 58 | 54 27 2c 20 26 6f 66 66 |il, 'TEX|T', &off|
|00001dd0| 73 65 74 29 20 29 0d 09 | 09 09 09 70 61 73 74 65 |set) )..|...paste|
|00001de0| 20 3d 20 74 72 75 65 3b | 0d 09 09 09 2f 2f 20 65 | = true;|....// e|
|00001df0| 6e 61 62 6c 65 20 73 61 | 76 65 20 69 66 20 77 65 |nable sa|ve if we|
|00001e00| 20 61 72 65 20 64 69 72 | 74 79 0d 09 09 09 73 61 | are dir|ty....sa|
|00001e10| 76 65 20 3d 20 66 43 75 | 72 44 6f 63 2d 3e 43 61 |ve = fCu|rDoc->Ca|
|00001e20| 6e 53 61 76 65 28 29 3b | 0d 09 09 09 73 61 76 65 |nSave();|....save|
|00001e30| 41 73 20 3d 20 66 43 75 | 72 44 6f 63 2d 3e 43 61 |As = fCu|rDoc->Ca|
|00001e40| 6e 53 61 76 65 41 73 28 | 29 3b 0d 09 09 20 20 7d |nSaveAs(|);... }|
|00001e50| 0d 09 20 20 7d 0d 09 69 | 66 20 28 73 61 76 65 29 |.. }..i|f (save)|
|00001e60| 0d 09 20 20 45 6e 61 62 | 6c 65 49 74 65 6d 28 66 |.. Enab|leItem(f|
|00001e70| 69 6c 65 4d 65 6e 75 2c | 20 69 53 61 76 65 29 3b |ileMenu,| iSave);|
|00001e80| 0d 09 65 6c 73 65 20 44 | 69 73 61 62 6c 65 49 74 |..else D|isableIt|
|00001e90| 65 6d 28 66 69 6c 65 4d | 65 6e 75 2c 20 69 53 61 |em(fileM|enu, iSa|
|00001ea0| 76 65 29 3b 0d 09 69 66 | 20 28 73 61 76 65 41 73 |ve);..if| (saveAs|
|00001eb0| 29 0d 09 20 20 45 6e 61 | 62 6c 65 49 74 65 6d 28 |).. Ena|bleItem(|
|00001ec0| 66 69 6c 65 4d 65 6e 75 | 2c 20 69 53 61 76 65 41 |fileMenu|, iSaveA|
|00001ed0| 73 29 3b 0d 09 65 6c 73 | 65 20 44 69 73 61 62 6c |s);..els|e Disabl|
|00001ee0| 65 49 74 65 6d 28 66 69 | 6c 65 4d 65 6e 75 2c 20 |eItem(fi|leMenu, |
|00001ef0| 69 53 61 76 65 41 73 29 | 3b 0d 0d 09 69 66 20 28 |iSaveAs)|;...if (|
|00001f00| 75 6e 64 6f 29 0d 09 20 | 20 45 6e 61 62 6c 65 49 |undo).. | EnableI|
|00001f10| 74 65 6d 28 65 64 69 74 | 4d 65 6e 75 2c 20 69 55 |tem(edit|Menu, iU|
|00001f20| 6e 64 6f 29 3b 0d 09 65 | 6c 73 65 20 44 69 73 61 |ndo);..e|lse Disa|
|00001f30| 62 6c 65 49 74 65 6d 28 | 65 64 69 74 4d 65 6e 75 |bleItem(|editMenu|
|00001f40| 2c 20 69 55 6e 64 6f 29 | 3b 0d 09 69 66 20 28 20 |, iUndo)|;..if ( |
|00001f50| 63 75 74 43 6f 70 79 43 | 6c 65 61 72 20 29 0d 09 |cutCopyC|lear )..|
|00001f60| 20 20 7b 0d 09 09 45 6e | 61 62 6c 65 49 74 65 6d | {...En|ableItem|
|00001f70| 28 65 64 69 74 4d 65 6e | 75 2c 20 69 43 75 74 29 |(editMen|u, iCut)|
|00001f80| 3b 0d 09 09 45 6e 61 62 | 6c 65 49 74 65 6d 28 65 |;...Enab|leItem(e|
|00001f90| 64 69 74 4d 65 6e 75 2c | 20 69 43 6f 70 79 29 3b |ditMenu,| iCopy);|
|00001fa0| 0d 09 09 45 6e 61 62 6c | 65 49 74 65 6d 28 65 64 |...Enabl|eItem(ed|
|00001fb0| 69 74 4d 65 6e 75 2c 20 | 69 43 6c 65 61 72 29 3b |itMenu, |iClear);|
|00001fc0| 0d 09 20 20 7d 0d 09 65 | 6c 73 65 0d 09 20 20 7b |.. }..e|lse.. {|
|00001fd0| 0d 09 09 44 69 73 61 62 | 6c 65 49 74 65 6d 28 65 |...Disab|leItem(e|
|00001fe0| 64 69 74 4d 65 6e 75 2c | 20 69 43 75 74 29 3b 0d |ditMenu,| iCut);.|
|00001ff0| 09 09 44 69 73 61 62 6c | 65 49 74 65 6d 28 65 64 |..Disabl|eItem(ed|
|00002000| 69 74 4d 65 6e 75 2c 20 | 69 43 6f 70 79 29 3b 0d |itMenu, |iCopy);.|
|00002010| 09 09 44 69 73 61 62 6c | 65 49 74 65 6d 28 65 64 |..Disabl|eItem(ed|
|00002020| 69 74 4d 65 6e 75 2c 20 | 69 43 6c 65 61 72 29 3b |itMenu, |iClear);|
|00002030| 0d 09 20 20 7d 0d 09 69 | 66 20 28 70 61 73 74 65 |.. }..i|f (paste|
|00002040| 29 0d 09 20 20 45 6e 61 | 62 6c 65 49 74 65 6d 28 |).. Ena|bleItem(|
|00002050| 65 64 69 74 4d 65 6e 75 | 2c 20 69 50 61 73 74 65 |editMenu|, iPaste|
|00002060| 29 3b 0d 09 65 6c 73 65 | 20 44 69 73 61 62 6c 65 |);..else| Disable|
|00002070| 49 74 65 6d 28 65 64 69 | 74 4d 65 6e 75 2c 20 69 |Item(edi|tMenu, i|
|00002080| 50 61 73 74 65 29 3b 0d | 09 69 66 20 28 73 65 6c |Paste);.|.if (sel|
|00002090| 65 63 74 41 6c 6c 29 0d | 09 20 20 45 6e 61 62 6c |ectAll).|. Enabl|
|000020a0| 65 49 74 65 6d 28 65 64 | 69 74 4d 65 6e 75 2c 20 |eItem(ed|itMenu, |
|000020b0| 69 53 65 6c 65 63 74 41 | 6c 6c 29 3b 0d 09 65 6c |iSelectA|ll);..el|
|000020c0| 73 65 20 44 69 73 61 62 | 6c 65 49 74 65 6d 28 65 |se Disab|leItem(e|
|000020d0| 64 69 74 4d 65 6e 75 2c | 20 69 53 65 6c 65 63 74 |ditMenu,| iSelect|
|000020e0| 41 6c 6c 29 3b 0d 7d 20 | 2f 2f 20 41 64 6a 75 73 |All);.} |// Adjus|
|000020f0| 74 4d 65 6e 75 73 0d 0d | 0d 2f 2f 20 54 68 69 73 |tMenus..|.// This|
|00002100| 20 69 73 20 63 61 6c 6c | 65 64 20 77 68 65 6e 20 | is call|ed when |
|00002110| 61 6e 20 69 74 65 6d 20 | 69 73 20 63 68 6f 73 65 |an item |is chose|
|00002120| 6e 20 66 72 6f 6d 20 74 | 68 65 20 6d 65 6e 75 20 |n from t|he menu |
|00002130| 62 61 72 20 28 61 66 74 | 65 72 20 63 61 6c 6c 69 |bar (aft|er calli|
|00002140| 6e 67 0d 2f 2f 20 4d 65 | 6e 75 53 65 6c 65 63 74 |ng.// Me|nuSelect|
|00002150| 20 6f 72 20 4d 65 6e 75 | 4b 65 79 29 2e 20 49 74 | or Menu|Key). It|
|00002160| 20 64 6f 65 73 20 74 68 | 65 20 72 69 67 68 74 20 | does th|e right |
|00002170| 74 68 69 6e 67 20 66 6f | 72 20 65 61 63 68 20 63 |thing fo|r each c|
|00002180| 6f 6d 6d 61 6e 64 2e 0d | 0d 76 6f 69 64 20 54 45 |ommand..|.void TE|
|00002190| 53 61 6d 70 6c 65 3a 3a | 44 6f 4d 65 6e 75 43 6f |Sample::|DoMenuCo|
|000021a0| 6d 6d 61 6e 64 28 73 68 | 6f 72 74 20 6d 65 6e 75 |mmand(sh|ort menu|
|000021b0| 49 44 2c 20 73 68 6f 72 | 74 20 6d 65 6e 75 49 74 |ID, shor|t menuIt|
|000021c0| 65 6d 29 0d 7b 0d 09 73 | 68 6f 72 74 09 09 69 74 |em).{..s|hort..it|
|000021d0| 65 6d 48 69 74 3b 0d 09 | 53 74 72 32 35 35 09 09 |emHit;..|Str255..|
|000021e0| 64 61 4e 61 6d 65 3b 0d | 09 73 68 6f 72 74 09 09 |daName;.|.short..|
|000021f0| 64 61 52 65 66 4e 75 6d | 3b 0d 09 57 69 6e 64 6f |daRefNum|;..Windo|
|00002200| 77 50 74 72 09 77 69 6e | 64 6f 77 3b 0d 09 54 45 |wPtr.win|dow;..TE|
|00002210| 44 6f 63 75 6d 65 6e 74 | 2a 20 66 54 45 43 75 72 |Document|* fTECur|
|00002220| 44 6f 63 20 3d 20 28 54 | 45 44 6f 63 75 6d 65 6e |Doc = (T|EDocumen|
|00002230| 74 2a 29 20 66 43 75 72 | 44 6f 63 3b 0d 0d 09 77 |t*) fCur|Doc;...w|
|00002240| 69 6e 64 6f 77 20 3d 20 | 46 72 6f 6e 74 57 69 6e |indow = |FrontWin|
|00002250| 64 6f 77 28 29 3b 0d 09 | 73 77 69 74 63 68 20 28 |dow();..|switch (|
|00002260| 20 6d 65 6e 75 49 44 20 | 29 0d 09 20 20 7b 0d 09 | menuID |).. {..|
|00002270| 09 63 61 73 65 20 6d 41 | 70 70 6c 65 3a 0d 09 09 |.case mA|pple:...|
|00002280| 09 73 77 69 74 63 68 20 | 28 20 6d 65 6e 75 49 74 |.switch |( menuIt|
|00002290| 65 6d 20 29 0d 09 09 09 | 20 20 7b 0d 09 09 09 09 |em )....| {.....|
|000022a0| 63 61 73 65 20 69 41 62 | 6f 75 74 3a 09 09 2f 2f |case iAb|out:..//|
|000022b0| 20 62 72 69 6e 67 20 75 | 70 20 61 6c 65 72 74 20 | bring u|p alert |
|000022c0| 66 6f 72 20 41 62 6f 75 | 74 0d 09 09 09 09 09 69 |for Abou|t......i|
|000022d0| 74 65 6d 48 69 74 20 3d | 20 41 6c 65 72 74 28 72 |temHit =| Alert(r|
|000022e0| 41 62 6f 75 74 41 6c 65 | 72 74 2c 20 6e 69 6c 29 |AboutAle|rt, nil)|
|000022f0| 3b 0d 09 09 09 09 09 62 | 72 65 61 6b 3b 0d 09 09 |;......b|reak;...|
|00002300| 09 09 64 65 66 61 75 6c | 74 3a 09 09 09 2f 2f 20 |..defaul|t:...// |
|00002310| 61 6c 6c 20 6e 6f 6e 2d | 41 62 6f 75 74 20 69 74 |all non-|About it|
|00002320| 65 6d 73 20 69 6e 20 74 | 68 69 73 20 6d 65 6e 75 |ems in t|his menu|
|00002330| 20 61 72 65 20 44 41 73 | 20 65 74 20 61 6c 0d 09 | are DAs| et al..|
|00002340| 09 09 09 09 47 65 74 49 | 74 65 6d 28 47 65 74 4d |....GetI|tem(GetM|
|00002350| 48 61 6e 64 6c 65 28 6d | 41 70 70 6c 65 29 2c 20 |Handle(m|Apple), |
|00002360| 6d 65 6e 75 49 74 65 6d | 2c 20 64 61 4e 61 6d 65 |menuItem|, daName|
|00002370| 29 3b 0d 09 09 09 09 09 | 64 61 52 65 66 4e 75 6d |);......|daRefNum|
|00002380| 20 3d 20 4f 70 65 6e 44 | 65 73 6b 41 63 63 28 64 | = OpenD|eskAcc(d|
|00002390| 61 4e 61 6d 65 29 3b 0d | 09 09 09 09 09 62 72 65 |aName);.|.....bre|
|000023a0| 61 6b 3b 0d 09 09 09 20 | 20 7d 0d 09 09 09 62 72 |ak;.... | }....br|
|000023b0| 65 61 6b 3b 0d 09 09 63 | 61 73 65 20 6d 46 69 6c |eak;...c|ase mFil|
|000023c0| 65 3a 0d 09 09 09 73 77 | 69 74 63 68 20 28 20 6d |e:....sw|itch ( m|
|000023d0| 65 6e 75 49 74 65 6d 20 | 29 0d 09 09 09 20 20 7b |enuItem |).... {|
|000023e0| 0d 09 09 09 09 63 61 73 | 65 20 69 4e 65 77 3a 0d |.....cas|e iNew:.|
|000023f0| 09 09 09 09 09 44 6f 4e | 65 77 28 29 3b 0d 09 09 |.....DoN|ew();...|
|00002400| 09 09 09 62 72 65 61 6b | 3b 0d 09 09 09 09 63 61 |...break|;.....ca|
|00002410| 73 65 20 69 4f 70 65 6e | 3a 0d 09 09 09 09 09 44 |se iOpen|:......D|
|00002420| 6f 4f 70 65 6e 28 29 3b | 0d 09 09 09 09 09 62 72 |oOpen();|......br|
|00002430| 65 61 6b 3b 0d 09 09 09 | 09 63 61 73 65 20 69 43 |eak;....|.case iC|
|00002440| 6c 6f 73 65 3a 0d 09 09 | 09 09 09 69 66 20 28 66 |lose:...|...if (f|
|00002450| 54 45 43 75 72 44 6f 63 | 20 21 3d 20 6e 69 6c 29 |TECurDoc| != nil)|
|00002460| 0d 09 09 09 09 09 20 20 | 7b 0d 09 09 09 09 09 09 |...... |{.......|
|00002470| 2f 2f 20 6f 6e 6c 79 20 | 63 6c 6f 73 65 20 74 68 |// only |close th|
|00002480| 65 20 64 6f 63 75 6d 65 | 6e 74 20 69 66 20 74 68 |e docume|nt if th|
|00002490| 65 20 75 73 65 72 20 64 | 6f 65 73 6e 27 74 20 63 |e user d|oesn't c|
|000024a0| 61 6e 63 65 6c 0d 09 09 | 09 09 09 09 69 66 20 28 |ancel...|....if (|
|000024b0| 66 54 45 43 75 72 44 6f | 63 2d 3e 44 6f 43 6c 6f |fTECurDo|c->DoClo|
|000024c0| 73 65 28 74 72 75 65 2c | 20 79 65 73 52 65 73 75 |se(true,| yesResu|
|000024d0| 6c 74 2c 20 66 61 6c 73 | 65 29 20 21 3d 20 63 61 |lt, fals|e) != ca|
|000024e0| 6e 63 65 6c 52 65 73 75 | 6c 74 29 0d 09 09 09 09 |ncelResu|lt).....|
|000024f0| 09 09 20 20 7b 0d 09 09 | 09 09 09 09 09 66 44 6f |.. {...|.....fDo|
|00002500| 63 4c 69 73 74 2d 3e 52 | 65 6d 6f 76 65 44 6f 63 |cList->R|emoveDoc|
|00002510| 28 66 54 45 43 75 72 44 | 6f 63 29 3b 0d 09 09 09 |(fTECurD|oc);....|
|00002520| 09 09 09 09 64 65 6c 65 | 74 65 20 66 54 45 43 75 |....dele|te fTECu|
|00002530| 72 44 6f 63 3b 0d 09 09 | 09 09 09 09 20 20 7d 0d |rDoc;...|.... }.|
|00002540| 09 09 09 09 09 20 20 7d | 0d 09 09 09 09 09 65 6c |..... }|......el|
|00002550| 73 65 20 43 6c 6f 73 65 | 44 65 73 6b 41 63 63 28 |se Close|DeskAcc(|
|00002560| 28 28 57 69 6e 64 6f 77 | 50 65 65 6b 29 20 66 57 |((Window|Peek) fW|
|00002570| 68 69 63 68 57 69 6e 64 | 6f 77 29 2d 3e 77 69 6e |hichWind|ow)->win|
|00002580| 64 6f 77 4b 69 6e 64 29 | 3b 0d 09 09 09 09 09 2f |dowKind)|;....../|
|00002590| 2f 20 6d 61 6b 65 20 73 | 75 72 65 20 6f 75 72 20 |/ make s|ure our |
|000025a0| 63 75 72 72 65 6e 74 20 | 64 6f 63 75 6d 65 6e 74 |current |document|
|000025b0| 2f 77 69 6e 64 6f 77 20 | 72 65 66 65 72 65 6e 63 |/window |referenc|
|000025c0| 65 73 20 61 72 65 20 76 | 61 6c 69 64 0d 09 09 09 |es are v|alid....|
|000025d0| 09 09 66 57 68 69 63 68 | 57 69 6e 64 6f 77 20 3d |..fWhich|Window =|
|000025e0| 20 46 72 6f 6e 74 57 69 | 6e 64 6f 77 28 29 3b 0d | FrontWi|ndow();.|
|000025f0| 09 09 09 09 09 69 66 20 | 28 66 57 68 69 63 68 57 |.....if |(fWhichW|
|00002600| 69 6e 64 6f 77 20 21 3d | 20 6e 69 6c 29 0d 09 09 |indow !=| nil)...|
|00002610| 09 09 09 20 20 7b 0d 09 | 09 09 09 09 09 66 43 75 |... {..|.....fCu|
|00002620| 72 44 6f 63 20 3d 20 66 | 44 6f 63 4c 69 73 74 2d |rDoc = f|DocList-|
|00002630| 3e 46 69 6e 64 44 6f 63 | 28 66 57 68 69 63 68 57 |>FindDoc|(fWhichW|
|00002640| 69 6e 64 6f 77 29 3b 0d | 09 09 09 09 09 09 53 65 |indow);.|......Se|
|00002650| 74 50 6f 72 74 28 66 57 | 68 69 63 68 57 69 6e 64 |tPort(fW|hichWind|
|00002660| 6f 77 29 3b 0d 09 09 09 | 09 09 20 20 7d 0d 09 09 |ow);....|.. }...|
|00002670| 09 09 09 65 6c 73 65 20 | 66 43 75 72 44 6f 63 20 |...else |fCurDoc |
|00002680| 3d 20 6e 69 6c 3b 0d 09 | 09 09 09 09 62 72 65 61 |= nil;..|....brea|
|00002690| 6b 3b 0d 09 09 09 09 63 | 61 73 65 20 69 53 61 76 |k;.....c|ase iSav|
|000026a0| 65 3a 0d 09 09 09 09 09 | 69 66 20 28 66 54 45 43 |e:......|if (fTEC|
|000026b0| 75 72 44 6f 63 20 21 3d | 20 6e 69 6c 29 0d 09 09 |urDoc !=| nil)...|
|000026c0| 09 09 09 20 20 66 54 45 | 43 75 72 44 6f 63 2d 3e |... fTE|CurDoc->|
|000026d0| 44 6f 53 61 76 65 28 29 | 3b 0d 09 09 09 09 09 62 |DoSave()|;......b|
|000026e0| 72 65 61 6b 3b 0d 09 09 | 09 09 63 61 73 65 20 69 |reak;...|..case i|
|000026f0| 53 61 76 65 41 73 3a 0d | 09 09 09 09 09 69 66 20 |SaveAs:.|.....if |
|00002700| 28 66 54 45 43 75 72 44 | 6f 63 20 21 3d 20 6e 69 |(fTECurD|oc != ni|
|00002710| 6c 29 0d 09 09 09 09 09 | 20 20 66 54 45 43 75 72 |l)......| fTECur|
|00002720| 44 6f 63 2d 3e 44 6f 53 | 61 76 65 41 73 28 29 3b |Doc->DoS|aveAs();|
|00002730| 0d 09 09 09 09 09 62 72 | 65 61 6b 3b 0d 09 09 09 |......br|eak;....|
|00002740| 09 63 61 73 65 20 69 51 | 75 69 74 3a 0d 09 09 09 |.case iQ|uit:....|
|00002750| 09 09 44 6f 51 75 69 74 | 28 74 72 75 65 2c 20 79 |..DoQuit|(true, y|
|00002760| 65 73 52 65 73 75 6c 74 | 29 3b 0d 09 09 09 09 09 |esResult|);......|
|00002770| 62 72 65 61 6b 3b 0d 09 | 09 09 20 20 7d 0d 09 09 |break;..|.. }...|
|00002780| 09 62 72 65 61 6b 3b 0d | 09 09 63 61 73 65 20 6d |.break;.|..case m|
|00002790| 45 64 69 74 3a 09 09 09 | 09 09 2f 2f 20 63 61 6c |Edit:...|..// cal|
|000027a0| 6c 20 53 79 73 74 65 6d | 45 64 69 74 20 66 6f 72 |l System|Edit for|
|000027b0| 20 44 41 20 65 64 69 74 | 69 6e 67 20 26 20 4d 75 | DA edit|ing & Mu|
|000027c0| 6c 74 69 46 69 6e 64 65 | 72 0d 09 09 09 69 66 20 |ltiFinde|r....if |
|000027d0| 28 21 53 79 73 74 65 6d | 45 64 69 74 28 6d 65 6e |(!System|Edit(men|
|000027e0| 75 49 74 65 6d 2d 31 29 | 29 0d 09 09 09 20 20 7b |uItem-1)|).... {|
|000027f0| 0d 09 09 09 09 73 77 69 | 74 63 68 20 28 6d 65 6e |.....swi|tch (men|
|00002800| 75 49 74 65 6d 29 0d 09 | 09 09 09 20 20 7b 0d 09 |uItem)..|... {..|
|00002810| 09 09 09 09 63 61 73 65 | 20 69 43 75 74 3a 0d 09 |....case| iCut:..|
|00002820| 09 09 09 09 09 66 54 45 | 43 75 72 44 6f 63 2d 3e |.....fTE|CurDoc->|
|00002830| 44 6f 43 75 74 28 29 3b | 0d 09 09 09 09 09 09 62 |DoCut();|.......b|
|00002840| 72 65 61 6b 3b 0d 09 09 | 09 09 09 63 61 73 65 20 |reak;...|...case |
|00002850| 69 43 6f 70 79 3a 0d 09 | 09 09 09 09 09 66 54 45 |iCopy:..|.....fTE|
|00002860| 43 75 72 44 6f 63 2d 3e | 44 6f 43 6f 70 79 28 29 |CurDoc->|DoCopy()|
|00002870| 3b 0d 09 09 09 09 09 09 | 62 72 65 61 6b 3b 0d 09 |;.......|break;..|
|00002880| 09 09 09 09 63 61 73 65 | 20 69 50 61 73 74 65 3a |....case| iPaste:|
|00002890| 0d 09 09 09 09 09 09 66 | 54 45 43 75 72 44 6f 63 |.......f|TECurDoc|
|000028a0| 2d 3e 44 6f 50 61 73 74 | 65 28 29 3b 0d 09 09 09 |->DoPast|e();....|
|000028b0| 09 09 09 62 72 65 61 6b | 3b 0d 09 09 09 09 09 63 |...break|;......c|
|000028c0| 61 73 65 20 69 43 6c 65 | 61 72 3a 0d 09 09 09 09 |ase iCle|ar:.....|
|000028d0| 09 09 66 54 45 43 75 72 | 44 6f 63 2d 3e 44 6f 43 |..fTECur|Doc->DoC|
|000028e0| 6c 65 61 72 28 29 3b 0d | 09 09 09 09 09 09 62 72 |lear();.|......br|
|000028f0| 65 61 6b 3b 0d 09 09 09 | 09 09 63 61 73 65 20 69 |eak;....|..case i|
|00002900| 53 65 6c 65 63 74 41 6c | 6c 3a 0d 09 09 09 09 09 |SelectAl|l:......|
|00002910| 09 66 54 45 43 75 72 44 | 6f 63 2d 3e 44 6f 53 65 |.fTECurD|oc->DoSe|
|00002920| 6c 65 63 74 41 6c 6c 28 | 29 3b 0d 09 09 09 09 09 |lectAll(|);......|
|00002930| 09 62 72 65 61 6b 3b 0d | 09 09 09 09 20 20 20 7d |.break;.|.... }|
|00002940| 0d 09 09 09 20 20 7d 0d | 09 09 09 62 72 65 61 6b |.... }.|...break|
|00002950| 3b 0d 09 20 20 7d 0d 09 | 48 69 6c 69 74 65 4d 65 |;.. }..|HiliteMe|
|00002960| 6e 75 28 30 29 3b 09 09 | 09 09 09 2f 2f 20 75 6e |nu(0);..|...// un|
|00002970| 68 69 67 68 6c 69 67 68 | 74 20 77 68 61 74 20 4d |highligh|t what M|
|00002980| 65 6e 75 53 65 6c 65 63 | 74 20 28 6f 72 20 4d 65 |enuSelec|t (or Me|
|00002990| 6e 75 4b 65 79 29 20 68 | 69 6c 69 74 65 64 0d 7d |nuKey) h|ilited.}|
|000029a0| 20 2f 2f 20 44 6f 4d 65 | 6e 75 43 6f 6d 6d 61 6e | // DoMe|nuComman|
|000029b0| 64 0d 0d 2f 2f 20 43 72 | 65 61 74 65 20 61 20 6e |d..// Cr|eate a n|
|000029c0| 65 77 20 64 6f 63 75 6d | 65 6e 74 20 61 6e 64 20 |ew docum|ent and |
|000029d0| 77 69 6e 64 6f 77 2e 0d | 0d 76 6f 69 64 20 54 45 |window..|.void TE|
|000029e0| 53 61 6d 70 6c 65 3a 3a | 44 6f 4e 65 77 28 29 0d |Sample::|DoNew().|
|000029f0| 7b 0d 09 54 45 44 6f 63 | 75 6d 65 6e 74 2a 20 74 |{..TEDoc|ument* t|
|00002a00| 44 6f 63 3b 0d 0d 09 74 | 44 6f 63 20 3d 20 6e 65 |Doc;...t|Doc = ne|
|00002a10| 77 20 54 45 44 6f 63 75 | 6d 65 6e 74 28 72 44 6f |w TEDocu|ment(rDo|
|00002a20| 63 57 69 6e 64 6f 77 29 | 3b 0d 09 46 61 69 6c 4e |cWindow)|;..FailN|
|00002a30| 49 4c 28 74 44 6f 63 29 | 3b 0d 0d 09 54 52 59 0d |IL(tDoc)|;...TRY.|
|00002a40| 09 20 20 7b 0d 09 09 74 | 44 6f 63 2d 3e 4f 70 65 |. {...t|Doc->Ope|
|00002a50| 6e 4e 65 77 44 6f 63 28 | 29 3b 0d 09 09 66 44 6f |nNewDoc(|);...fDo|
|00002a60| 63 4c 69 73 74 2d 3e 41 | 64 64 44 6f 63 28 74 44 |cList->A|ddDoc(tD|
|00002a70| 6f 63 29 3b 0d 09 20 20 | 7d 0d 09 52 45 43 4f 56 |oc);.. |}..RECOV|
|00002a80| 45 52 0d 09 20 20 7b 0d | 09 09 64 65 6c 65 74 65 |ER.. {.|..delete|
|00002a90| 20 74 44 6f 63 3b 0d 09 | 20 20 7d 0d 09 45 4e 44 | tDoc;..| }..END|
|00002aa0| 54 52 59 0d 7d 20 2f 2f | 20 44 6f 4e 65 77 0d 0d |TRY.} //| DoNew..|
|00002ab0| 76 6f 69 64 20 54 45 53 | 61 6d 70 6c 65 3a 3a 4f |void TES|ample::O|
|00002ac0| 70 65 6e 41 44 6f 63 28 | 73 68 6f 72 74 20 76 52 |penADoc(|short vR|
|00002ad0| 65 66 4e 75 6d 2c 20 6c | 6f 6e 67 20 64 69 72 49 |efNum, l|ong dirI|
|00002ae0| 44 2c 20 53 74 72 69 6e | 67 50 74 72 20 66 4e 61 |D, Strin|gPtr fNa|
|00002af0| 6d 65 2c 20 4f 53 54 79 | 70 65 20 66 54 79 70 65 |me, OSTy|pe fType|
|00002b00| 29 0d 7b 0d 09 69 66 20 | 28 66 54 79 70 65 20 21 |).{..if |(fType !|
|00002b10| 3d 20 6b 54 45 46 69 6c | 65 54 79 70 65 29 0d 09 |= kTEFil|eType)..|
|00002b20| 20 20 46 61 69 6c 75 72 | 65 28 65 42 61 64 46 69 | Failur|e(eBadFi|
|00002b30| 6c 65 54 79 70 65 2c 6b | 54 45 44 6f 63 45 72 72 |leType,k|TEDocErr|
|00002b40| 53 74 72 69 6e 67 73 29 | 3b 0d 0d 09 54 45 44 6f |Strings)|;...TEDo|
|00002b50| 63 75 6d 65 6e 74 2a 20 | 74 44 6f 63 20 3d 20 6e |cument* |tDoc = n|
|00002b60| 65 77 20 54 45 44 6f 63 | 75 6d 65 6e 74 28 72 44 |ew TEDoc|ument(rD|
|00002b70| 6f 63 57 69 6e 64 6f 77 | 29 3b 0d 09 46 61 69 6c |ocWindow|);..Fail|
|00002b80| 4e 49 4c 28 74 44 6f 63 | 29 3b 0d 0d 09 54 52 59 |NIL(tDoc|);...TRY|
|00002b90| 0d 09 20 20 7b 0d 09 09 | 43 61 6e 6f 6e 69 63 61 |.. {...|Canonica|
|00002ba0| 6c 46 69 6c 65 53 70 65 | 63 20 66 69 6c 65 53 70 |lFileSpe|c fileSp|
|00002bb0| 65 63 3b 0d 0d 09 09 66 | 69 6c 65 53 70 65 63 2e |ec;....f|ileSpec.|
|00002bc0| 76 52 65 66 4e 75 6d 20 | 3d 20 76 52 65 66 4e 75 |vRefNum |= vRefNu|
|00002bd0| 6d 3b 0d 09 09 66 69 6c | 65 53 70 65 63 2e 64 69 |m;...fil|eSpec.di|
|00002be0| 72 49 44 20 3d 20 64 69 | 72 49 44 3b 0d 09 09 43 |rID = di|rID;...C|
|00002bf0| 6f 70 79 50 53 74 72 69 | 6e 67 28 66 69 6c 65 53 |opyPStri|ng(fileS|
|00002c00| 70 65 63 2e 66 69 6c 65 | 4e 61 6d 65 2c 20 66 4e |pec.file|Name, fN|
|00002c10| 61 6d 65 29 3b 0d 0d 09 | 09 74 44 6f 63 2d 3e 4f |ame);...|.tDoc->O|
|00002c20| 70 65 6e 4f 6c 64 44 6f | 63 28 66 69 6c 65 53 70 |penOldDo|c(fileSp|
|00002c30| 65 63 2c 66 61 6c 73 65 | 29 3b 0d 09 09 66 44 6f |ec,false|);...fDo|
|00002c40| 63 4c 69 73 74 2d 3e 41 | 64 64 44 6f 63 28 74 44 |cList->A|ddDoc(tD|
|00002c50| 6f 63 29 3b 0d 09 20 20 | 7d 0d 09 52 45 43 4f 56 |oc);.. |}..RECOV|
|00002c60| 45 52 0d 09 20 20 7b 0d | 09 09 64 65 6c 65 74 65 |ER.. {.|..delete|
|00002c70| 20 74 44 6f 63 3b 0d 09 | 20 20 7d 0d 09 45 4e 44 | tDoc;..| }..END|
|00002c80| 54 52 59 0d 7d 0d 0d 76 | 6f 69 64 20 54 45 53 61 |TRY.}..v|oid TESa|
|00002c90| 6d 70 6c 65 3a 3a 44 6f | 4f 70 65 6e 28 29 0d 7b |mple::Do|Open().{|
|00002ca0| 0d 09 50 6f 69 6e 74 20 | 77 68 65 72 65 3b 0d 09 |..Point |where;..|
|00002cb0| 53 74 72 32 35 35 20 70 | 72 6f 6d 70 74 3b 0d 09 |Str255 p|rompt;..|
|00002cc0| 53 46 54 79 70 65 4c 69 | 73 74 20 74 79 70 65 4c |SFTypeLi|st typeL|
|00002cd0| 69 73 74 3b 0d 09 53 46 | 52 65 70 6c 79 20 72 65 |ist;..SF|Reply re|
|00002ce0| 70 6c 79 3b 0d 09 73 68 | 6f 72 74 20 76 52 65 66 |ply;..sh|ort vRef|
|00002cf0| 4e 75 6d 3b 0d 09 6c 6f | 6e 67 20 64 69 72 49 44 |Num;..lo|ng dirID|
|00002d00| 3b 0d 0d 09 53 65 74 50 | 74 28 26 77 68 65 72 65 |;...SetP|t(&where|
|00002d10| 2c 31 30 30 2c 31 30 30 | 29 3b 0d 09 70 72 6f 6d |,100,100|);..prom|
|00002d20| 70 74 5b 30 5d 20 3d 20 | 27 5c 30 27 3b 0d 09 74 |pt[0] = |'\0';..t|
|00002d30| 79 70 65 4c 69 73 74 5b | 30 5d 20 3d 20 6b 54 45 |ypeList[|0] = kTE|
|00002d40| 46 69 6c 65 54 79 70 65 | 3b 0d 09 53 46 47 65 74 |FileType|;..SFGet|
|00002d50| 46 69 6c 65 28 77 68 65 | 72 65 2c 70 72 6f 6d 70 |File(whe|re,promp|
|00002d60| 74 2c 28 46 69 6c 65 46 | 69 6c 74 65 72 50 72 6f |t,(FileF|ilterPro|
|00002d70| 63 50 74 72 29 20 6e 69 | 6c 2c 0d 09 09 09 20 20 |cPtr) ni|l,.... |
|00002d80| 31 2c 74 79 70 65 4c 69 | 73 74 2c 28 44 6c 67 48 |1,typeLi|st,(DlgH|
|00002d90| 6f 6f 6b 50 72 6f 63 50 | 74 72 29 20 6e 69 6c 2c |ookProcP|tr) nil,|
|00002da0| 26 72 65 70 6c 79 29 3b | 0d 09 69 66 20 28 72 65 |&reply);|..if (re|
|00002db0| 70 6c 79 2e 67 6f 6f 64 | 20 3d 3d 20 66 61 6c 73 |ply.good| == fals|
|00002dc0| 65 29 0d 09 20 20 72 65 | 74 75 72 6e 3b 0d 0d 09 |e).. re|turn;...|
|00002dd0| 57 44 54 6f 44 69 72 49 | 44 28 72 65 70 6c 79 2e |WDToDirI|D(reply.|
|00002de0| 76 52 65 66 4e 75 6d 2c | 76 52 65 66 4e 75 6d 2c |vRefNum,|vRefNum,|
|00002df0| 64 69 72 49 44 29 3b 0d | 09 4f 70 65 6e 41 44 6f |dirID);.|.OpenADo|
|00002e00| 63 28 76 52 65 66 4e 75 | 6d 2c 64 69 72 49 44 2c |c(vRefNu|m,dirID,|
|00002e10| 72 65 70 6c 79 2e 66 4e | 61 6d 65 2c 20 6b 54 45 |reply.fN|ame, kTE|
|00002e20| 46 69 6c 65 54 79 70 65 | 29 3b 0d 7d 0d 00 00 00 |FileType|);.}....|
|00002e30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002e40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002e50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002e60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002e70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002e80| 00 00 01 00 00 00 02 9e | 00 00 01 9e 00 00 00 4a |........|.......J|
|00002e90| 43 6f 70 79 43 6c 65 61 | 72 20 3d 20 54 52 55 45 |CopyClea|r = TRUE|
|00002ea0| 3b 0d 09 09 70 61 73 74 | 65 20 3d 20 54 52 55 45 |;...past|e = TRUE|
|00002eb0| 0b 54 45 53 61 6d 70 6c | 65 2e 63 70 02 00 00 00 |.TESampl|e.cp....|
|00002ec0| 54 45 58 54 4d 50 53 20 | 01 00 00 28 00 60 00 00 |TEXTMPS |...(.`..|
|00002ed0| 00 00 54 45 58 54 4d 50 | 53 20 01 00 00 28 00 60 |..TEXTMP|S ...(.`|
|00002ee0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002ef0| 00 00 a2 64 55 93 00 00 | 00 00 00 00 02 e8 29 5b |...dU...|......)[|
|00002f00| 30 5d 5b 30 5d 20 29 0d | 09 09 09 69 66 20 28 20 |0][0] ).|...if ( |
|00002f10| 73 65 6c 53 74 61 72 74 | 20 3c 20 73 65 6c 45 6e |selStart| < selEn|
|00002f20| 64 20 29 0d 09 09 09 09 | 63 75 74 43 6f 70 79 43 |d ).....|cutCopyC|
|00002f30| 6c 65 61 72 20 3d 20 54 | 52 55 45 3b 0d 09 09 09 |lear = T|RUE;....|
|00002f40| 09 2f 2a 43 75 74 2c 20 | 43 6f 70 79 2c 20 61 6e |./*Cut, |Copy, an|
|00002f50| 64 20 43 6c 65 61 72 20 | 69 73 20 65 6e 61 62 6c |d Clear |is enabl|
|00002f60| 65 64 20 66 6f 72 20 61 | 70 70 2e 20 77 69 6e 64 |ed for a|pp. wind|
|00002f70| 6f 77 73 20 77 69 74 68 | 20 73 65 6c 65 63 74 69 |ows with| selecti|
|00002f80| 00 00 00 1e 00 50 00 20 | 01 dd 02 3d 00 50 00 20 |.....P. |...=.P. |
|00002f90| 01 dd 02 3d 00 00 0a 5c | 00 00 00 00 00 00 00 00 |...=...\|........|
|00002fa0| 00 00 00 00 00 48 00 09 | 4d 6f 6e 61 63 6f 00 00 |.....H..|Monaco..|
|00002fb0| 01 d1 00 00 00 14 00 01 | 21 a8 00 0a 00 00 00 00 |........|!.......|
|00002fc0| 00 00 00 00 01 d8 00 00 | 00 06 00 04 00 2a 00 05 |........|.....*..|
|00002fd0| 01 d3 02 5d 00 2a 00 05 | 01 d3 02 5d a2 61 1f fb |...].*..|...].a..|
|00002fe0| 00 00 00 00 00 00 00 00 | 00 00 00 00 01 00 00 00 |........|........|
|00002ff0| 01 2c 00 0b 00 00 09 13 | 00 00 09 1e 05 6d 61 69 |.,......|.....mai|
|00003000| 6e 00 00 00 0c 92 00 00 | 0c a4 13 54 45 53 61 6d |n.......|...TESam|
|00003010| 70 6c 65 3a 3a 54 45 53 | 61 6d 70 6c 65 00 00 00 |ple::TES|ample...|
|00003020| 0e 5a 00 00 0e 6e 15 54 | 45 53 61 6d 70 6c 65 3a |.Z...n.T|ESample:|
|00003030| 3a 48 65 61 70 4e 65 65 | 64 65 64 00 00 00 0f 15 |:HeapNee|ded.....|
|00003040| 00 00 0f 27 13 54 45 53 | 61 6d 70 6c 65 3a 3a 53 |...'.TES|ample::S|
|00003050| 6c 65 65 70 56 61 6c 00 | 00 00 10 ba 00 00 10 ca |leepVal.|........|
|00003060| 11 54 45 53 61 6d 70 6c | 65 3a 3a 44 6f 49 64 6c |.TESampl|e::DoIdl|
|00003070| 65 00 00 00 11 c8 00 00 | 11 de 17 54 45 53 61 6d |e.......|...TESam|
|00003080| 70 6c 65 3a 3a 41 64 6a | 75 73 74 43 75 72 73 6f |ple::Adj|ustCurso|
|00003090| 72 00 00 00 18 5e 00 00 | 18 73 15 54 45 53 61 6d |r....^..|.s.TESam|
|000030a0| 70 6c 65 3a 3a 41 64 6a | 75 73 74 4d 65 6e 75 73 |ple::Adj|ustMenus|
|000030b0| 00 00 21 0e 00 00 21 25 | 17 54 45 53 61 6d 70 6c |..!...!%|.TESampl|
|000030c0| 65 3a 3a 44 6f 4d 65 6e | 75 43 6f 6d 6d 61 6e 64 |e::DoMen|uCommand|
|000030d0| 00 00 29 5e 00 00 29 6d | 0f 54 45 53 61 6d 70 6c |..)^..)m|.TESampl|
|000030e0| 65 3a 3a 44 6f 4e 65 77 | 00 00 2a 35 00 00 2a 47 |e::DoNew|..*5..*G|
|000030f0| 13 54 45 53 61 6d 70 6c | 65 3a 3a 4f 70 65 6e 41 |.TESampl|e::OpenA|
|00003100| 44 6f 63 00 00 00 2c 0c | 00 00 2c 1c 11 54 45 53 |Doc...,.|..,..TES|
|00003110| 61 6d 70 6c 65 3a 3a 44 | 6f 4f 70 65 6e 00 00 00 |ample::D|oOpen...|
|00003120| 01 00 00 00 02 9e 00 00 | 01 9e 00 00 00 4a 00 34 |........|.....J.4|
|00003130| 5b 34 06 fc 00 00 00 1c | 00 4a 00 00 4d 50 53 52 |[4......|.J..MPSR|
|00003140| 00 02 00 0a 03 f0 ff ff | 00 00 00 00 00 00 00 00 |........|........|
|00003150| 03 ed ff ff 00 00 00 22 | 00 00 00 00 03 ef ff ff |......."|........|
|00003160| 00 00 00 6e 00 36 4f 48 | 00 00 00 00 00 00 00 00 |...n.6OH|........|
|00003170| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+